This is the mail archive of the
mailing list for the GDB project.
Re: How to ignore errors in user defined commands?
- From: Tom Tromey <tromey at redhat dot com>
- To: Steffen Dettmer <steffen dot dettmer at googlemail dot com>
- Cc: gdb at sourceware dot org
- Date: Tue, 22 Jun 2010 10:12:20 -0600
- Subject: Re: How to ignore errors in user defined commands?
- References: <AANLkTikFC2jhIrQQFzUfQsKDTymKpWb30tsKv_sFoT2l@mail.gmail.com>
- Reply-to: tromey at redhat dot com
>>>>> "Steffen" == Steffen Dettmer <email@example.com> writes:
Steffen> when an error occures, the execution of a user define command
Steffen> stops. How can I avoid this?
Steffen> I use arm-elf-gdb-6.8 to debug my remote target.
With 6.8, I think there is no way.
A long time ago there was a patch to add exception handling to the gdb
command language. This is still in bugzilla somewhere. I don't know
why it was never applied.
With a Python-enabled gdb you can write a command like the appended.
Then you can "ignore-errors do something".
class IgnoreErrorsCommand (gdb.Command):
"""Execute a single command, ignoring all errors.
Only one-line commands are supported.
This is primarily useful in scripts."""
def __init__ (self):
super (IgnoreErrorsCommand, self).__init__ ("ignore-errors",
def invoke (self, arg, from_tty):
gdb.execute (arg, from_tty)