[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.
This commit is contained in:
Tom de Vries
2021-09-22 11:47:50 +02:00
parent cf11ebea12
commit 479209dd4f
5 changed files with 29 additions and 10 deletions

View File

@@ -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)
{