This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: how GDB use ptrace to return from a function
- From: Yubin Ruan <ablacktshirt at gmail dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb at sourceware dot org
- Date: Sat, 18 Nov 2017 11:46:21 +0800
- Subject: Re: how GDB use ptrace to return from a function
- Authentication-results: sourceware.org; auth=none
- References: <CAJYFCiMqA1NO-32g7_vrwpU-h7dmyPaqUe=UZzey1gfFz7ax3g@mail.gmail.com> <20171117161059.3oxfgipkgknfymrm@adacore.com>
Thanks Joel,
2017-11-18 0:10 GMT+08:00 Joel Brobecker <brobecker@adacore.com>:
>> 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.
what break point events are common for X86?
Yubin