Hi, >>> 1. On many distributions, _dl_debug_state compiles to a single 'ret'. >> >> For us it happens not to be an issue. Our profiler has limited ability to >> rewrite code on the fly, so as long as we can get a symbol address we can >> inject a trap into the function code and have all the calls vectored into >> our code. > > It sounds like you are ptracing the executable, in which case you *are* > an external debugger, and so (naturally) have no difficulty.
Not that it matters much, but we're not ptracing. We literally rewrite the machine code on the fly (well, part of the prologue). We save the original prologue, relocate it for any %rip-relative addresses etc., patch in a call into our own code, which then decides to do whatever it wants - usually calls the original code plus does some bookkeeping work. As long as _dl_debug_state() has enough space to patch in the jump to our code, it should work for us. The dynamic linkers I looked seem to be built with enough code padding that there's space to replace the ret with a jump. Anyway, it's not a general solution. Regards, Lassi _______________________________________________ Libunwind-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/libunwind-devel
