This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/8] Disassembly unit test: disassemble one instruction


I'd much prefer if the core of the unit testing framework doesn't learn
about different random subsystems.  Consider what we'd do if we
wanted to reuse selftest.c in gdbserver.  I think we will at some point.

How about we move all this gdbarch stuff elsewhere, like
gdb/arch-utils.c or a new gdb/arch-selftests.c?

You'd then have,

- call the new function typedef "arch_self_test_function"

- in arch-selftests.c:

static std::vector<arch_self_test_function *> gdbarch_tests;

void
register_arch_self_test (arch_self_test_function *function)
{
  gdbarch_tests.push_back (function);
}

namespace selftests {

arch_tests ()
{
  for (const auto &f : gdbarch_tests)
    {
      const char **arches = gdbarch_printable_names ();
      int i;
   [...]
}

} /* namespace selftests */

void
_initialize_arch_selftests (void)
{
#if GDB_SELF_TEST
  register_self_test (selftests::arch_tests);
#endif
}

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]