aboutsummaryrefslogtreecommitdiff
path: root/gdb/maint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/maint.c')
-rw-r--r--gdb/maint.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gdb/maint.c b/gdb/maint.c
index 48de207..766ab74 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -1,6 +1,6 @@
/* Support for GDB maintenance commands.
- Copyright (C) 1992-2024 Free Software Foundation, Inc.
+ Copyright (C) 1992-2025 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
@@ -28,8 +28,6 @@
#include "symtab.h"
#include "block.h"
#include "gdbtypes.h"
-#include "demangle.h"
-#include "gdbcore.h"
#include "expression.h"
#include "language.h"
#include "symfile.h"
@@ -41,6 +39,7 @@
#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"
@@ -110,6 +109,18 @@ maintenance_demangle (const char *args, int from_tty)
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)
{
@@ -1345,6 +1356,12 @@ This command has been moved to \"demangle\"."),
&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,