Re: [PATCH v8 3/6] gdb, cli: pass the argument of a set command to its callback.
Andrew Burgess <[email protected]> Wed, 22 Jul 2026 21:16:54 +0100
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
Klaus Gerlicher <[email protected]> writes: > From: Natalia Saiapova <[email protected]> > > This might be useful, if some commands need to have a special case if > run w/o arguments. The body of a commit message should ideally not run-on from the title line. This first sentence only makes sense after reading the title. Anyway, I think there's a bug in this commit. For the setting types: var_uinteger, var_integer, and var_pinteger we call parse_cli_var_integer which can modify ARG. This means you'll not be passing through the actual argument of the set command in these cases. I think the fix is easy enough, just capture the original ARG near the start of do_set_command. I think all the setting types are fine, but if you just capture the original ARG value and use that in the 'c->func' call you'll be covered. Thanks, Andrew > > I am going to use it in > gdb: refine commands to control scheduler locking. > to keep the old behaviour of the > set scheduler-locking step > which should set both > set scheduler-locking step on > set scheduler-locking replay step on > To do this, the set-command needs to detect that it was issued without > arguments and have a special handling for this. > > Without the special handling, the command > set scheduler-locking step > would set only > set scheduler-locking step on > > Approved-By: Tom Tromey <[email protected]> > --- > gdb/cli/cli-setshow.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c > index 7688da015de..f1f313a4cd0 100644 > --- a/gdb/cli/cli-setshow.c > +++ b/gdb/cli/cli-setshow.c > @@ -455,7 +455,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c) > error (_("gdb internal error: bad var_type in do_setshow_command")); > } > > - c->func (NULL, from_tty, c); > + c->func (arg, from_tty, c); > > if (notify_command_param_changed_p (option_changed, c)) > { > -- > 2.34.1 > > Intel Deutschland GmbH > > Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany > Tel: +49 89 991 430, www.intel.de > Managing Directors: Harry Demas, Jeffrey Schneiderman, Yin Chong Sorrell > Chairperson of the Supervisory Board: Nicole Lau > Registered Seat: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928