aboutsummaryrefslogtreecommitdiff
path: root/gdb/disasm-selftests.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-09-22 11:47:50 +0200
committerTom de Vries <tdevries@suse.de>2021-09-22 11:47:50 +0200
commit479209dd4ff90c0bc66d80ebdcb1f21ea8fbb62d (patch)
treea691e68cad6f280d8898557a6b6cea72cda0c9af /gdb/disasm-selftests.c
parentcf11ebea1206a7c459a94fef8e0880087dd9f38f (diff)
downloadgdb-479209dd4ff90c0bc66d80ebdcb1f21ea8fbb62d.zip
gdb-479209dd4ff90c0bc66d80ebdcb1f21ea8fbb62d.tar.gz
gdb-479209dd4ff90c0bc66d80ebdcb1f21ea8fbb62d.tar.bz2
[gdb] Add maint selftest -verbose option
The print_one_insn selftest in gdb/disasm-selftests.c contains: ... /* If you want to see the disassembled instruction printed to gdb_stdout, set verbose to true. */ static const bool verbose = false; ... Make this parameter available in the maint selftest command using a new option -verbose, such that we can do: ... (gdb) maint selftest -verbose print_one_insn ... Tested on x86_64-linux.
Diffstat (limited to 'gdb/disasm-selftests.c')
-rw-r--r--gdb/disasm-selftests.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index ae71e71..0a383d6 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -103,8 +103,7 @@ print_one_insn_test (struct gdbarch *gdbarch)
/* Test gdb_disassembler for a given gdbarch by reading data from a
pre-allocated buffer. If you want to see the disassembled
- instruction printed to gdb_stdout, set verbose to true. */
- static const bool verbose = false;
+ instruction printed to gdb_stdout, use maint selftest -verbose. */
class gdb_disassembler_test : public gdb_disassembler
{
@@ -114,7 +113,7 @@ print_one_insn_test (struct gdbarch *gdbarch)
const gdb_byte *insn,
size_t len)
: gdb_disassembler (gdbarch,
- (verbose ? gdb_stdout : &null_stream),
+ (run_verbose () ? gdb_stdout : &null_stream),
gdb_disassembler_test::read_memory),
m_insn (insn), m_len (len)
{
@@ -123,7 +122,7 @@ print_one_insn_test (struct gdbarch *gdbarch)
int
print_insn (CORE_ADDR memaddr)
{
- if (verbose)
+ if (run_verbose ())
{
fprintf_unfiltered (stream (), "%s ",
gdbarch_bfd_arch_info (arch ())->arch_name);
@@ -131,7 +130,7 @@ print_one_insn_test (struct gdbarch *gdbarch)
int len = gdb_disassembler::print_insn (memaddr);
- if (verbose)
+ if (run_verbose ())
fprintf_unfiltered (stream (), "\n");
return len;