[PATCH 2/2] gdb: add risc-v disassembler options support

Andrew Burgess aburgess@redhat.com
Thu Nov 25 17:40:53 GMT 2021


From: Andrew Burgess <andrew.burgess@embecosm.com>

This commit adds support for RISC-V disassembler options to GDB.  This
commit is based on this patch which was never committed:

  https://sourceware.org/pipermail/binutils/2021-January/114944.html

All of the binutils refactoring has been moved to a separate, earlier,
commit, so this commit is pretty straight forward, just registering
the required gdbarch hooks.

Co-authored-by: Simon Cook <simon.cook@embecosm.com>
---
 gdb/riscv-tdep.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 94dad41a9fd..4d87a899063 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -101,6 +101,9 @@ static const char *riscv_feature_name_fpu = "org.gnu.gdb.riscv.fpu";
 static const char *riscv_feature_name_virtual = "org.gnu.gdb.riscv.virtual";
 static const char *riscv_feature_name_vector = "org.gnu.gdb.riscv.vector";
 
+/* The current set of options to be passed to the disassembler.  */
+static char *riscv_disassembler_options;
+
 /* Cached information about a frame.  */
 
 struct riscv_unwind_cache
@@ -3803,6 +3806,11 @@ riscv_gdbarch_init (struct gdbarch_info info,
   set_gdbarch_gcc_target_options (gdbarch, riscv_gcc_target_options);
   set_gdbarch_gnu_triplet_regexp (gdbarch, riscv_gnu_triplet_regexp);
 
+  /* Disassembler options support.  */
+  set_gdbarch_valid_disassembler_options (gdbarch,
+					  disassembler_options_riscv ());
+  set_gdbarch_disassembler_options (gdbarch, &riscv_disassembler_options);
+
   /* Hook in OS ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 
-- 
2.25.4



More information about the Gdb-patches mailing list