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:Jonathan Adams (jwad@gmail.com)
Date:Aug 25, 2007 12:11:58 am
List:org.opensolaris.mdb-discuss

On 8/24/07, zhijun <Zhijun.Fu at sun.com> wrote:

Eric Schrock wrote:

You have a couple different things in play here.

First, MDB pipelines only work with uintptr_t's, not arbitrary text. So when you try to pipe something like "foo: X" or "X Y Z" to another dcmd, the parser will choke.

Normally, the formatting commands ('/' and friends) recognize when you are in pipe context and omit any extraneous formatting characters. Since they only output numbers, they are safe to use in pipe context.

However, under ::eval, any notion of pipe context is (intentionally) ignored. So ::eval '/Kn' will print the extra formatting characters (such as "swap_vnodes:") as it has no way of knowing it's being used in pipe context outside the eval context. One way to get around this is to do something like:

::array ... p | ::eval '<p/Kn | =Kn' | ::grep .==0

Why are you guys using ::eval for this, anyway? Isn't this what ::map was designed for?

(i.e. ::map '*.', or ::map '*<p' or something?)

Cheers, - jonathan