]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Improve maintenance command output format
authorLuis Machado <luis.machado@linaro.org>
Tue, 22 Jun 2021 19:22:12 +0000 (16:22 -0300)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:59:19 +0000 (15:59 -0700)
Instead of printing just the capability bytes, print it also in the verbose
and compact formats.

gdb/ChangeLog:

2021-06-24  Luis Machado  <luis.machado@arm.com>

* aarch64-linux-tdep.c: Include gdbsupport/capability.h.
(maint_print_cap_from_addr_cmd): Print more information.

gdb/aarch64-linux-tdep.c

index 080e8e15ea762db8227cfd6715f6d364a3dbbe39..07ea274f6bfedc7f374d7cc04f446ad797189a4d 100644 (file)
@@ -61,6 +61,8 @@
 #include "elf/common.h"
 #include "elf/aarch64.h"
 
+#include "gdbsupport/capability.h"
+
 /* Signal frame handling.
 
       +------------+  ^
@@ -2137,10 +2139,29 @@ maint_print_cap_from_addr_cmd (const char *args, int from_tty)
   CORE_ADDR addr = parse_and_eval_address (args);
   cap = target_read_capability (addr);
 
+  if (cap.empty ())
+    {
+      fprintf_unfiltered (gdb_stdlog,
+                         "Could not read capability from address %s.\n",
+                         phex_nz (addr, 8));
+      return;
+    }
+
   for (auto it : cap)
     fprintf_unfiltered (gdb_stdlog, "%02x ", it);
+  fputs_unfiltered ("\n", gdb_stdlog);
+
+  bool tag = (cap[0] == 1);
+  uint128_t cap_128bits;
+  memcpy (&cap_128bits, &cap[1], 16);
+
+  capability capability (cap_128bits, tag);
 
+  fprintf_unfiltered (gdb_stdlog, "verbose: %s\n",
+                     capability.to_str (false).c_str ());
   fputs_unfiltered ("\n", gdb_stdlog);
+  fprintf_unfiltered (gdb_stdlog, "compact: %s\n",
+                     capability.to_str (true).c_str ());
 }
 
 /* Implement the maintenance set capability in memory command.  */