[RFC][gdb/cli] Ignore error in gdb command script
Simon Marchi
simon.marchi@polymtl.ca
Tue May 18 14:10:44 GMT 2021
On 2021-05-18 9:57 a.m., Tom de Vries wrote:> On 5/18/21 1:12 PM, Marco Barisione wrote:
>> On 18 May 2021, at 10:59, Tom de Vries <tdevries@suse.de> wrote:
>>> Hi,
>>>
>>> While trying to reproduce a failing test-case from the testsuite on the
>>> command line using a gdb command script, I ran into the problem that a command
>>> failed which stopped script execution.
>>>
>>> I could work around this by splitting the script at each error, but I realized
>>> it would be nice if I could tell gdb to ignore the error.
>>>
>>> Inspired by make, I chose the '-' prefix.
>>
>> As MI commands are prefixed by “-“, isn’t there a risk of confusion?
>>
>
> Ah, right, I tend to forget about MI, good point.
>
>> There’s also a “-” command (see tui/tui-win.c) which will stop working with
>> your patch.
>
> I see, that's:
> ...
> $ gdb -q -batch -ex "help -"
> Scroll window backward.
> Usage: - [N] [WIN]
> Scroll window WIN N lines backwards. Both WIN and N are optional, N
> defaults to 1, and WIN defaults to the currently focused window.
> ...
>
> FWIW, did not find any documentation for this command.
>
> Anyway, the '-' prefix seems a poor choice.
>
> I've updated the patch to implement the ignore-errors idiom natively (so
> it also works without python).
>
> Also, I've managed to fix the hang, by copying some code from
> execute_gdb_command.
That sounds useful. I think that "ignore-errors" is a good initial
name, because it's clear and self-describing. We can always find and
add a short alias later.
I didn't look much at the patch itself, but read the commit message. I
would vote for implementing it as a command, to avoid adding more
complexity / exceptions / special cases in the command handling code.
Simon
More information about the Gdb-patches
mailing list