From: Luis Machado Date: Tue, 22 Jun 2021 19:22:12 +0000 (-0300) Subject: Improve maintenance command output format X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f7528c72e48233d0d18454ac7379e7fd777efdd;p=thirdparty%2Fbinutils-gdb.git Improve maintenance command output format Instead of printing just the capability bytes, print it also in the verbose and compact formats. gdb/ChangeLog: 2021-06-24 Luis Machado * aarch64-linux-tdep.c: Include gdbsupport/capability.h. (maint_print_cap_from_addr_cmd): Print more information. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a4fa095d066..d1a29a6112a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-06-24 Luis Machado + + * aarch64-linux-tdep.c: Include gdbsupport/capability.h. + (maint_print_cap_from_addr_cmd): Print more information. + 2021-06-24 Luis Machado * aarch64-tdep.c: Include elf/aarch64.h. diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index bada46f8442..ccb2d3cd173 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -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. */