!= works but you have to use quote otherwise the ! is interpreted as a pipe to a shell command ; so you can do:
*swap_vnodes::array "struct vnode *" 0t2048 | /Kn | ::grep '. != 0' alex. zhijun wrote: > 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 > > Regards, > Zhijun >> >> 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 >>> _______________________________________________ >>> mdb-discuss mailing list >>> mdb-discuss at opensolaris.org >