This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Breakpoint commands


Paul Pluzhnikov wrote:
On Sat, Oct 24, 2009 at 9:30 AM, Eli Zaretskii <eliz@gnu.org> wrote:
From: Pedro Alves <pedro@codesourcery.com>
Date: Sat, 24 Oct 2009 17:03:59 +0100

"You can use breakpoint commands to start your program up again.  Simply
use the @code{continue} command, or @code{step}, or any other command
that resumes execution.

Any other commands in the command list, after a command that resumes
execution, are ignored.  This is because any time you resume execution
(even with a simple @code{next} or @code{step}), you may encounter
another breakpoint---which could have its own command list, leading to
ambiguities about which list to execute."
Thanks for reminding me.  We ought to display a warning when any
commands are used on the command list beyond those which resume.

FWIW, I very often would like to do this:


int foo(int x) { ... }

break foo
command 1
print x
finish  ## expecting it to print return of foo()
continue

and that last 'continue' of course doesn't work, so I have to sit an
press enter all day :-(

The argument of "you may encounter other breakpoints ..." is (IMHO) a
weak one: I *don't* in fact encounter any other breakpoints.

I think the "argument" that you may encounter other breakpoints is in part a rationalization. In reality, it seems to me that we just didn't want to make breakpoint command handling (which would have included handle_inferior_event) recursive.


It's probably not too difficult to implement "if you encounter any
other breakpoint with its own command list while executing the
original command list, the original command list is abandoned" policy.
I'll open a feature request unless somebody explains why this would be
a bad idea.

Thanks,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]