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;
}
test_gdb_complete_none "$show_cmd "
}
+# Check that $_gdb_setting & co report the correct error strings.
+proc test-setting-error {} {
+ gdb_test {print $_gdb_setting("xxx")} \
+ "First argument of \\\$_gdb_setting must be a valid setting of the 'show' command\\."
+ gdb_test {print $_gdb_setting_str("xxx")} \
+ "First argument of \\\$_gdb_setting_str must be a valid setting of the 'show' command\\."
+
+ gdb_test {print $_gdb_maint_setting("xxx")} \
+ "First argument of \\\$_gdb_maint_setting must be a valid setting of the 'maintenance show' command\\."
+ gdb_test {print $_gdb_maint_setting_str("xxx")} \
+ "First argument of \\\$_gdb_maint_setting_str must be a valid setting of the 'maintenance show' command\\."
+}
+
foreach variant {
uinteger
integer
test-string $variant
}
}
+
+test-setting-error