how GDB use ptrace to return from a function

Joel Brobecker brobecker@adacore.com
Fri Nov 17 16:11:00 GMT 2017


> I don't know whether GDB is using this kind of technique. If anyone
> know that, can you enlighten me, and probably point me to the source?

GDB sets the call up so that the return address is at specific
location (usually the program's entry point, but that's arch-
dependent), and then places a breakpoint at that address. It
then knows, when receiving the corresponding breakpoint event,
that a breakpoint at that address corresponds to the end of
the function that we called.

-- 
Joel



More information about the Gdb mailing list