Rui Paulo
2010-08-10 15:46:51 UTC
Hi,
I'm posting a question hoping someone will know the answer off hand thereby reducing my search time. :-)
With USDT probes, the tracepoint is only installed by libdtrace itself, never by the drti ioctl. So whenever I run a program with an USDT probe, no tracepoint is installed. Only after I run the dtrace command the tracepoint is actually installed on the victim process.
My question is about how Solaris discovers the correct instruction pointer (PC) on the target victim. The DOF only has information relative to the offset inside the function where the probe is defined and the address of the function in the _relocatable_ object.
So, whenever I'm building a program with an usdt probe I get:
libdtrace DEBUG: defined probe database:::query-start main() +0x13 (main)
When I run 'dtrace -n 'database*:::'' the fasttrap module inserts the probe at the 0x13 offset, not the actually vaddr of main() + offset. I added a debug printf in fasttrap_tracepoint_enable():
installing tracepoint on pid 1288 pc 0x13
Of course this doesn't work because main() is actually at 0x4011d0.
To overcome this I thought that dtrace(1) would try to grab the process and discover the vaddr of main. But from I can see dtrace(1) never grabs the process.
How does DTrace work for this case on Solaris? Where's the magic for installing the trap instruction at 0x4011d0 + 0x13 ?
Thanks,
--
Rui Paulo
I'm posting a question hoping someone will know the answer off hand thereby reducing my search time. :-)
With USDT probes, the tracepoint is only installed by libdtrace itself, never by the drti ioctl. So whenever I run a program with an USDT probe, no tracepoint is installed. Only after I run the dtrace command the tracepoint is actually installed on the victim process.
My question is about how Solaris discovers the correct instruction pointer (PC) on the target victim. The DOF only has information relative to the offset inside the function where the probe is defined and the address of the function in the _relocatable_ object.
So, whenever I'm building a program with an usdt probe I get:
libdtrace DEBUG: defined probe database:::query-start main() +0x13 (main)
When I run 'dtrace -n 'database*:::'' the fasttrap module inserts the probe at the 0x13 offset, not the actually vaddr of main() + offset. I added a debug printf in fasttrap_tracepoint_enable():
installing tracepoint on pid 1288 pc 0x13
Of course this doesn't work because main() is actually at 0x4011d0.
To overcome this I thought that dtrace(1) would try to grab the process and discover the vaddr of main. But from I can see dtrace(1) never grabs the process.
How does DTrace work for this case on Solaris? Where's the magic for installing the trap instruction at 0x4011d0 + 0x13 ?
Thanks,
--
Rui Paulo