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 23, 2007 8:33:57 am
List:org.opensolaris.mdb-discuss

Alexandre Chartre wrote:

You can do:

*swap_vnodes::array "struct vnode *" 0t2048 | /Kn | ::grep .

alex.

Hi alex, Thanks, it works. Whille I still would like to know whether this is a way to specify "not equal" in mdb, so I can exclude the variables with some specific value, something like ::grep .!= 0x1234

zhijun wrote:

Hi folks, I met a problem when investigating the swap code. There is an array called swap_vnodes[],which contains pointers to all the swap vnodes in system.

static struct vnode **swap_vnodes; #define MAX_SWAP_VNODES 2048

While this is a pointer to pointer,I would like to dump the array and see which slots are already allocated.

mdb -k

swap_vnodes/K

swap_vnodes: swap_vnodes: fffffffecc47e000

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