]> 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)
committerLuis Machado <luis.machado@linaro.org>
Thu, 24 Jun 2021 13:43:24 +0000 (10:43 -0300)
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/ChangeLog
gdb/aarch64-linux-tdep.c

index a4fa095d066eb03a94c760417c7a1a92a62bce48..d1a29a6112a84a8848b682a5c6300fab1bac5903 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2021-06-24  Luis Machado  <luis.machado@arm.com>
 
        * aarch64-tdep.c: Include elf/aarch64.h.
index bada46f844245a2d8d4048ad3089a9c481b0773b..ccb2d3cd173102139e87f211c71edc3e189ab7b4 100644 (file)
@@ -54,6 +54,8 @@
 
 #include "elf/common.h"
 
+#include "gdbsupport/capability.h"
+
 /* Signal frame handling.
 
       +------------+  ^
@@ -1775,10 +1777,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.  */