Enda o''Connor - Sun Microsystems Ireland - Software Engineer
2006-Aug-15 16:55 UTC
[dtrace-discuss] help with listing called functions
Hi
I am trying to grab a flow controlled list of the functions under main
that patchadd calls when it is run
# which patchadd
/usr/sbin/patchadd
# ls -l /usr/sbin/patchadd
lrwxrwxrwx 1 root root 16 Aug 15 11:14 /usr/sbin/patchadd
-> ../lib/patch/pdo
# file /usr/lib/patch/pdo
/usr/lib/patch/pdo: ELF 32-bit MSB executable SPARC Version 1,
dynamically linked, stripped
#
So I have the following:
# cat /export/pdo.d
#pragma D option flowindent
pid$target::main:entry
{
self->trace = 1;
}
pid$target::main:return
/self->trace/
{
self->trace = 0;
}
pid$target:pdo::entry,
pid$target:pdo::return
/self->trace/
{
}
pid$target:a.out::entry,
pid$target:a.out::return
/self->trace/
{
}
#
I would have though that this would then generate a listing of the
functions called from main in ''pdo'', but it does not,
# dtrace -s /export/pdo.d -c "/usr/sbin/patchadd /export/119117-21"
which gives
....
Checking installed patches...
CPU FUNCTION
0 -> main
0 | main:entry
0 -> xcalloc
0 | xcalloc:entry
0 | xcalloc:return
0 <- xcalloc
0 -> xcalloc
.......
but main calls patchadd() pretty much at the start of main
What is wrong with my approach to this?
Enda
On Tue, Aug 15, 2006 at 05:55:06PM +0100, Enda o''Connor - Sun Microsystems Ireland - Software Engineer wrote:> Hi > I am trying to grab a flow controlled list of the functions under main > that patchadd calls when it is run > > > # which patchadd > /usr/sbin/patchadd > # ls -l /usr/sbin/patchadd > lrwxrwxrwx 1 root root 16 Aug 15 11:14 /usr/sbin/patchadd > -> ../lib/patch/pdo > # file /usr/lib/patch/pdo > /usr/lib/patch/pdo: ELF 32-bit MSB executable SPARC Version 1, > dynamically linked, stripped > # > > So I have the following: > > > # cat /export/pdo.d > #pragma D option flowindent > > pid$target::main:entry > { > self->trace = 1; > } > > pid$target::main:return > /self->trace/ > { > self->trace = 0; > } > > pid$target:pdo::entry, > pid$target:pdo::return > /self->trace/ > { > } > pid$target:a.out::entry, > pid$target:a.out::return > /self->trace/ > { > } > # > > > I would have though that this would then generate a listing of the > functions called from main in ''pdo'', but it does not, > > # dtrace -s /export/pdo.d -c "/usr/sbin/patchadd /export/119117-21" > > which gives > .... > Checking installed patches... > CPU FUNCTION > 0 -> main > 0 | main:entry > 0 -> xcalloc > 0 | xcalloc:entry > 0 | xcalloc:return > 0 <- xcalloc > 0 -> xcalloc > ....... > > but main calls patchadd() pretty much at the start of main > > > What is wrong with my approach to this?% file /usr/sbin/patchadd /usr/sbin/patchadd: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, stripped ^^^^^^^^ Without a symbol table, there is no record of the "patchadd" function. Get an unstripped version of the binary. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
Enda o''Connor - Sun Microsystems Ireland - Software Engineer
2006-Aug-18 12:30 UTC
[dtrace-discuss] help with listing called functions
Jonathan Adams wrote:>On Tue, Aug 15, 2006 at 05:55:06PM +0100, Enda o''Connor - Sun Microsystems Ireland - Software Engineer wrote: > > >>Hi >>I am trying to grab a flow controlled list of the functions under main >>that patchadd calls when it is run >> >> >># which patchadd >>/usr/sbin/patchadd >># ls -l /usr/sbin/patchadd >>lrwxrwxrwx 1 root root 16 Aug 15 11:14 /usr/sbin/patchadd >>-> ../lib/patch/pdo >># file /usr/lib/patch/pdo >>/usr/lib/patch/pdo: ELF 32-bit MSB executable SPARC Version 1, >>dynamically linked, stripped >># >> >>So I have the following: >> >> >># cat /export/pdo.d >>#pragma D option flowindent >> >>pid$target::main:entry >>{ >> self->trace = 1; >>} >> >>pid$target::main:return >>/self->trace/ >>{ >> self->trace = 0; >>} >> >>pid$target:pdo::entry, >>pid$target:pdo::return >>/self->trace/ >>{ >>} >>pid$target:a.out::entry, >>pid$target:a.out::return >>/self->trace/ >>{ >>} >># >> >> >>I would have though that this would then generate a listing of the >>functions called from main in ''pdo'', but it does not, >> >># dtrace -s /export/pdo.d -c "/usr/sbin/patchadd /export/119117-21" >> >>which gives >>.... >>Checking installed patches... >>CPU FUNCTION >> 0 -> main >> 0 | main:entry >> 0 -> xcalloc >> 0 | xcalloc:entry >> 0 | xcalloc:return >> 0 <- xcalloc >> 0 -> xcalloc >> ....... >> >>but main calls patchadd() pretty much at the start of main >> >> >>What is wrong with my approach to this? >> >> > >% file /usr/sbin/patchadd >/usr/sbin/patchadd: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ >Required, dynamically linked, stripped > ^^^^^^^^ > >Without a symbol table, there is no record of the "patchadd" function. Get >an unstripped version of the binary. > >Cheers, >- jonathan > > >Hi Thanks, tried the binary compiled with -g and all was good. Enda -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20060818/f66fcb46/attachment.html>