diff options
author | Tom de Vries <tdevries@suse.de> | 2021-09-22 11:47:50 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-09-22 11:47:50 +0200 |
commit | 479209dd4ff90c0bc66d80ebdcb1f21ea8fbb62d (patch) | |
tree | a691e68cad6f280d8898557a6b6cea72cda0c9af /gdbsupport | |
parent | cf11ebea1206a7c459a94fef8e0880087dd9f38f (diff) | |
download | gdb-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 'gdbsupport')
-rw-r--r-- | gdbsupport/selftest.cc | 15 | ||||
-rw-r--r-- | gdbsupport/selftest.h | 7 |
2 files changed, 20 insertions, 2 deletions
diff --git a/gdbsupport/selftest.cc b/gdbsupport/selftest.cc index 55f530a..589ef1e 100644 --- a/gdbsupport/selftest.cc +++ b/gdbsupport/selftest.cc @@ -70,10 +70,23 @@ register_test (const std::string &name, /* See selftest.h. */ +static bool run_verbose_ = false; + +/* See selftest.h. */ + +bool +run_verbose () +{ + return run_verbose_; +} + +/* See selftest.h. */ + void -run_tests (gdb::array_view<const char *const> filters) +run_tests (gdb::array_view<const char *const> filters, bool verbose) { int ran = 0, failed = 0; + run_verbose_ = verbose; for (const auto &pair : tests) { diff --git a/gdbsupport/selftest.h b/gdbsupport/selftest.h index b75e01e..d76fc4b 100644 --- a/gdbsupport/selftest.h +++ b/gdbsupport/selftest.h @@ -37,6 +37,10 @@ struct selftest virtual void operator() () const = 0; }; +/* True if selftest should run verbosely. */ + +extern bool run_verbose (); + /* Register a new self-test. */ extern void register_test (const std::string &name, selftest *test); @@ -52,7 +56,8 @@ extern void register_test (const std::string &name, If FILTERS is not empty, only run tests with names containing one of the element of FILTERS. */ -extern void run_tests (gdb::array_view<const char *const> filters); +extern void run_tests (gdb::array_view<const char *const> filters, + bool verbose = false); /* Reset GDB or GDBserver's internal state. */ extern void reset (); |