Hi,

I'm having C function

size_t mutt_iconv (iconv_t cd, char **inbuf, ...

I would like to print the inbuf using dtrace.

I was thinking to use something like

"PTR=copyin(arg1, 4); trace(copyinstr(PTR));" but it does not work for
me.

$ dtrace -32 -w -n 'pid14243::mutt_iconv:entry{printf("0x%x ", arg1); 
A=copyin(arg1,4); printf("0x%x ", ((unsigned int)A)); stop();}'
dtrace: description 'pid14243::mutt_iconv:entry' matched 1 probe
dtrace: allowing destructive actions
CPU     ID                    FUNCTION:NAME
  0  75510                 mutt_iconv:entry 0x8045168 0x97aa7018
^C

However if I try to dereference the pointer in mdb:

pub 12:54 ~/test: mdb -p 14243
Loading modules: [ ld.so.1 libc.so.1 ]
> 0x8045168/X
0x8045168:      8e4c038
>

I get correct resutl 8e4c038. I'm a bit confused, what am I doing wrong ?

And alternatively, is there better way of getting char **inbuf, than twhice 
manually copyin ?

Thanks

-- 
        Vlad

Attachment: pgpRvToYSACtH.pgp
Description: PGP signature

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to