[v4,3/6] gdb, cli: pass the argument of a set command to its callback.

Message ID 20251213143709.301799-4-christina.schimpe@intel.com
State New
Headers
Series Refinement of scheduler-locking settings |

Commit Message

Christina Schimpe Dec. 13, 2025, 2:37 p.m. UTC
  From: Natalia Saiapova <natalia.saiapova@intel.com>

This might be useful, if some commands need to have a special case if
run w/o arguments.

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
---
 gdb/cli/cli-setshow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index a97cd1b392b..feca27c8c75 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -456,7 +456,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))
     {