Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Command to break before exiting stack frame?
@ 2019-03-16 23:15 Justin Paston-Cooper
  2019-03-17  0:01 ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Justin Paston-Cooper @ 2019-03-16 23:15 UTC (permalink / raw)
  To: gdb

Hello,

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
reasons:

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
functions.

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,

Justin


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-03-19 20:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-16 23:15 Command to break before exiting stack frame? Justin Paston-Cooper
2019-03-17  0:01 ` Andreas Schwab
2019-03-17  0:23   ` Simon Marchi
2019-03-17 13:59     ` Justin Paston-Cooper
2019-03-19 15:42       ` Tom Tromey
2019-03-19 20:44         ` Justin Paston-Cooper
2019-03-19 15:35     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox