maintenance check symtabs
Renamed from maintenance check-symtabs
+maintenance canonicalize
+ Show the canonical form of a C++ name.
+
set riscv numeric-register-names on|off
show riscv numeric-register-names
Controls whether GDB refers to risc-v registers by their numeric names
This command is useful for debugging the agent version of dynamic
printf (@pxref{Dynamic Printf}).
+@kindex maint canonicalize
+@item maint canonicalize @var{name}
+Print the canonical form of @var{name}, a C@t{++} name. Because a
+C@t{++} name may have multiple possible spellings, @value{GDBN}
+computes a canonical form of a name for internal use. For example,
+@code{short int} and @code{short} are two ways to name the same type.
+
@kindex maint info breakpoints
@anchor{maint info breakpoints}
@item maint info breakpoints
#include "inferior.h"
#include "gdbsupport/thread-pool.h"
#include "event-top.h"
+#include "cp-support.h"
#include "cli/cli-decode.h"
#include "cli/cli-utils.h"
styled_string (command_style.style (), "demangle"));
}
+/* Print the canonical form of a name. */
+
+static void
+maintenance_canonicalize (const char *args, int from_tty)
+{
+ gdb::unique_xmalloc_ptr<char> canon = cp_canonicalize_string (args);
+ if (canon == nullptr)
+ gdb_printf ("No change.\n");
+ else
+ gdb_printf ("canonical = %s\n", canon.get ());
+}
+
static void
maintenance_time_display (const char *args, int from_tty)
{
&maintenancelist);
deprecate_cmd (cmd, "demangle");
+ cmd = add_cmd ("canonicalize", class_maintenance, maintenance_canonicalize,
+ _("\
+Show the canonical form of a C++ name.\n\
+Usage: maintenance canonicalize NAME"),
+ &maintenancelist);
+
add_prefix_cmd ("per-command", class_maintenance, set_per_command_cmd, _("\
Per-command statistics settings."),
&per_command_setlist,
gdb_test_no_output "maint print msymbols"
gdb_test_no_output "maint print psymbols"
+gdb_test "maint canonicalize int short" "canonical = short"
+gdb_test "maint canonicalize fn<ty<int>>" \
+ "canonical = fn<ty<int> >"
+gdb_test "maint canonical unsigned int" "No change\\."
+
gdb_exit