From: Joel Brobecker <brobecker@adacore.com>
To: Yubin Ruan <ablacktshirt@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: how GDB use ptrace to return from a function
Date: Fri, 17 Nov 2017 16:11:00 -0000 [thread overview]
Message-ID: <20171117161059.3oxfgipkgknfymrm@adacore.com> (raw)
In-Reply-To: <CAJYFCiMqA1NO-32g7_vrwpU-h7dmyPaqUe=UZzey1gfFz7ax3g@mail.gmail.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.
--
Joel
next prev parent reply other threads:[~2017-11-17 16:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 6:44 Yubin Ruan
2017-11-17 16:11 ` Joel Brobecker [this message]
2017-11-18 3:46 ` Yubin Ruan
2017-11-18 4:03 ` Joel Brobecker
2017-11-18 4:20 ` Yubin Ruan
2017-11-18 7:58 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171117161059.3oxfgipkgknfymrm@adacore.com \
--to=brobecker@adacore.com \
--cc=ablacktshirt@gmail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox