aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-05-09 15:18:51 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-05-12 10:54:25 +0100
commita02fcd08ddc5080696248ed7fb4bf50a24763431 (patch)
treeafe702279d9f9812321ca5fb2e0a48d27aaaabb8 /gdb/cli
parentcbd24a9f11feea879c2f1857053854ef329efbd8 (diff)
downloadgdb-a02fcd08ddc5080696248ed7fb4bf50a24763431.zip
gdb-a02fcd08ddc5080696248ed7fb4bf50a24763431.tar.gz
gdb-a02fcd08ddc5080696248ed7fb4bf50a24763431.tar.bz2
gdb: fix error message for $_gdb_maint_setting
I spotted this behaviour: (gdb) p $_gdb_maint_setting("xxx") First argument of $_gdb_maint_setting must be a valid setting of the 'show' command. Notice that GDB claims I need to use a setting from the 'show' command, which isn't correct for $_gdb_maint_setting, in this case I need to use a setting from 'maintenance show'. This same issue is present for $_gdb_maint_setting_str. This commit fixes this minor issue. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d466cc6..b7b6530 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2219,8 +2219,16 @@ setting_cmd (const char *fnname, struct cmd_list_element *showlist,
cmd_list_element *cmd = lookup_cmd (&a0, showlist, "", NULL, -1, 0);
if (cmd == nullptr || cmd->type != show_cmd)
- error (_("First argument of %s must be a "
- "valid setting of the 'show' command."), fnname);
+ {
+ gdb_assert (showlist->prefix != nullptr);
+ std::vector<std::string> components
+ = showlist->prefix->command_components ();
+ std::string full_name = components[0];
+ for (int i = 1; i < components.size (); ++i)
+ full_name += " " + components[i];
+ error (_("First argument of %s must be a valid setting of the "
+ "'%s' command."), fnname, full_name.c_str ());
+ }
return cmd;
}