From 61a5375b842e24b6f492efda7eb213b6e6cf677d Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 28 Sep 2021 22:11:57 +0100 Subject: [PATCH] gdb: add risc-v disassembler options support 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 --- 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.30.2