This is the mail archive of the
mailing list for the GDB project.
Command to break before exiting stack frame?
- From: Justin Paston-Cooper <paston dot cooper at gmail dot com>
- To: gdb at sourceware dot org
- Date: Sat, 16 Mar 2019 23:15:06 +0000
- Subject: Command to break before exiting stack frame?
I would be interested to see a command which breaks just before exiting the
current stack frame. I have so far seen this implemented as a custom
command in Python, which searches for 'retq' instructions in the current
stack frame. I am not an ASM expert, but I imagine that this might not work
for all architectures.
In any case, you might ask why I can't just use that instead of expecting
it as a native command in gdb. You might also ask why I don't just give the
line number of the returns of the function in question. There are a few
1. We already have a command to break at the beginning of a function given
its name (break).
2. We already have a command to continue to the end of the current stack
frame and then exit it (finish).
3. Analysing C/C++/other code with gcc is difficult. grep can tell me the
line numbers of returns in C/C++, but there might be other languages where
such a simple solution is not so readily available. In any case, it's still
an extra step.
4. rbreak breaks at the beginning of all functions matching a regex. It
would be simple and useful to add a "break on frame exit" command to the
commands part of an rbreak command to see the ending state of all chosen
I can't imagine that I am the first person to suggest or request this. Are
there any architectural or practical reasons as to why this is might be
difficult? I was not able to find any, but are there any existing,
equivalent and native solutions?
Thanks in advance,