13 messages in org.opensolaris.mdb-discuss[mdb-discuss] how to dump a array and...
FromSent OnAttachments
zhijunAug 23, 2007 7:15 am 
Alexandre ChartreAug 23, 2007 7:56 am 
zhijunAug 23, 2007 8:33 am 
Alexandre ChartreAug 23, 2007 8:36 am 
Eric SchrockAug 23, 2007 8:36 am 
zhijunAug 23, 2007 9:27 am 
Eric SchrockAug 23, 2007 9:36 am 
zhijunAug 24, 2007 8:28 am 
Eric SchrockAug 24, 2007 10:38 am 
zhijunAug 24, 2007 7:44 pm 
Jonathan AdamsAug 25, 2007 12:11 am 
Eric SchrockAug 25, 2007 8:37 am 
zhijunAug 26, 2007 6:00 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[mdb-discuss] how to dump a array and find which slots are non zero?Actions...
From:zhijun (Zhij@Sun.COM)
Date:Aug 24, 2007 8:28:38 am
List:org.opensolaris.mdb-discuss

fffffffecc47e000::array "struct vnode *" 0t2048 p|::eval <p/K 0xfffffffecc47e000: 0 0xfffffffecc47e008: 0 0xfffffffecc47e010: 0 0xfffffffecc47e018: 0 0xfffffffecc47e020: 0 0xfffffffecc47e028: 0 0xfffffffecc47e030: 0 0xfffffffecc47e038: 0 0xfffffffecc47e040: 0 0xfffffffecc47e048: 0 0xfffffffecc47e050: 0 0xfffffffecc47e058: 0 0xfffffffecc47e060: 0 0xfffffffecc47e068: 0 0xfffffffecc47e070: 0 ......

fffffffecc47e000::array "struct vnode *" 0t2048 p|::eval <p/K|::grep .!=0

sh: =0: not found mdb: syntax error on line 1 of (pipeline) near ":"

fffffffecc47e000::array "struct vnode *" 0t2048 p|::eval <p/K|::grep .==0

mdb: syntax error on line 1 of (pipeline) near ":"

0xfffffffecc47e000/K|::grep .!=0 sh: =0: not found 0xfffffffecc47e000/K|::grep .==0

0

My two questions: 1) It seems that != is not supported in mdb, so how can I specify "not equal" in mdb? 2) While == works, it doesn't work for the above case, I guess it is related to "/K", is there any way to work around it or do we need to fix it?

Thanks, Zhijun

While I still have some doublt for my second question, in which, fffffffecc47e000::array "struct vnode *" 0t2048 p|::eval <p/K|::grep .==0 doesn't work.

swap_vnodes/K

swap_vnodes: swap_vnodes: fffffffecb5bc000

fffffffecb5bc000::array "struct vnode *" 10

fffffffecb5bc000 fffffffecb5bc008 fffffffecb5bc010 fffffffecb5bc018 fffffffecb5bc020 fffffffecb5bc028 fffffffecb5bc030 fffffffecb5bc038 fffffffecb5bc040 fffffffecb5bc048 fffffffecb5bc050 fffffffecb5bc058 fffffffecb5bc060 fffffffecb5bc068 fffffffecb5bc070 fffffffecb5bc078

Use ::grep pipelined with ::eval<p=K can work while with ::eval <p/K doesn't work

fffffffecb5bc000::array "struct vnode *" 10 p|::eval <p=K|::grep .==0 /* this works */ fffffffecb5bc000::array "struct vnode *" 10 p|::eval <p/K|::grep

.==0 /* this doesn't work */ mdb: syntax error on line 1 of (pipeline) near ":"

fffffffecb5bc000::array "struct vnode *" 10 p|::eval <p=K

fffffffecb5bc000 fffffffecb5bc008 fffffffecb5bc010 fffffffecb5bc018 fffffffecb5bc020 fffffffecb5bc028 fffffffecb5bc030 fffffffecb5bc038 fffffffecb5bc040 fffffffecb5bc048 fffffffecb5bc050 fffffffecb5bc058 fffffffecb5bc060 fffffffecb5bc068 fffffffecb5bc070 fffffffecb5bc078

fffffffecb5bc000::array "struct vnode *" 10 p|::eval <p/K

0xfffffffecb5bc000: 0 0xfffffffecb5bc008: 0 0xfffffffecb5bc010: 0 0xfffffffecb5bc018: 0 0xfffffffecb5bc020: 0 0xfffffffecb5bc028: 0 0xfffffffecb5bc030: 0 0xfffffffecb5bc038: 0 0xfffffffecb5bc040: 0 0xfffffffecb5bc048: 0 0xfffffffecb5bc050: 0 0xfffffffecb5bc058: 0 0xfffffffecb5bc060: 0 0xfffffffecb5bc068: 0 0xfffffffecb5bc070: 0 0xfffffffecb5bc078: 0

Looking at the above output, I guess the reason is the output format, I checked "Solaris Modular Debugger Guide" and on page 32 it says each line in the output before '|' must consist of an arithmetic expression terminated by a NEWLINE or semicolon. So it seems that the reason here is that the output of ::eval <p=K doesn't conform to this thus breaks the pipeline of dcmds. But let's look at the output of /Kn

fffffffecb5bc000::array "struct vnode *" 10 |/Kn

0xfffffffecb5bc000: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

fffffffecb5bc000::array "struct vnode *" 10 |/Kn|::grep .==0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

My two questions here: While /n is added to make sure each expression occupies one line, here the first line does not exactly consist of an arithmetic expression, and it contains the address of the first entry in array, so I would expect it will break the pineline, but instead, it works fine. I am somehow puzzled about this. Could you give me some hint on this? Another question is why the output of /Kn and ::eval <p/K are different? Basically I think the output should be the same as they each takes an address and dump the content one line a time.