binutils-gdb/gdbsupport
Simon Marchi ece5bc8ac3 gdb: allow specifying multiple filters when running selftests
I found myself wanting to run a few specific selftests while developing.
I thought it would be nice to be able to provide multiple test names
when running `maintenant selftests`.  The arguments to that command is
currently interpreted as a single filter (not split by spaces), it now
becomes a list a filters, split by spaces.  A test is executed when it
matches at least one filter.

Here's an example of the result in GDB:

    (gdb) maintenance selftest xml
    Running selftest xml_escape_text.
    Running selftest xml_escape_text_append.
    Ran 2 unit tests, 0 failed
    (gdb) maintenance selftest xml unord
    Running selftest unordered_remove.
    Running selftest xml_escape_text.
    Running selftest xml_escape_text_append.
    Ran 3 unit tests, 0 failed
    (gdb) maintenance selftest xml unord foobar
    Running selftest unordered_remove.
    Running selftest xml_escape_text.
    Running selftest xml_escape_text_append.
    Ran 3 unit tests, 0 failed

Since the selftest machinery is also shared with gdbserver, I also
adapted gdbserver.  It accepts a `--selftest` switch, which accepts an
optional filter argument.  I made it so you can now pass `--selftest`
multiple time to add filters.

It's not so useful right now though: there's only a single selftest
right now in GDB and it's for an architecture I can't compile.  So I
tested by adding dummy tests, here's an example of the result:

    $ ./gdbserver --selftest=foo
    Running selftest foo.
    foo
    Running selftest foobar.
    foobar
    Ran 2 unit tests, 0 failed
    $ ./gdbserver --selftest=foo --selftest=bar
    Running selftest bar.
    bar
    Running selftest foo.
    foo
    Running selftest foobar.
    foobar
    Ran 3 unit tests, 0 failed

gdbsupport/ChangeLog:

	* selftest.h (run_tests): Change parameter to array_view.
	* selftest.c (run_tests): Change parameter to array_view and use
	it.

gdb/ChangeLog:

	* maint.c (maintenance_selftest): Split args and pass array_view
	to run_tests.

gdbserver/ChangeLog:

	* server.cc (captured_main): Accept multiple `--selftest=`
	options.  Pass all `--selftest=` arguments to run_tests.

Change-Id: I422bd49f08ea8095ae174c5d66a2dd502a59613a
2020-08-13 07:55:48 -04:00
..
.dir-locals.el gdbserver/gdbsupport: Add .dir-locals.el file 2020-03-06 11:29:46 +00:00
.gitattributes gdb, gdbserver, gdbsupport: add .gitattributes files 2020-03-05 15:59:22 +01:00
acinclude.m4 Move gdb/selftest.m4 to gdbsupport/selftest.m4 2020-03-12 14:19:38 -04:00
aclocal.m4
agent.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
agent.h
alt-stack.h
array-view.h
ax.def
block-signals.h
break-common.h
btrace-common.cc Don't pass NULL to memcpy in gdb 2020-03-31 07:29:53 -06:00
btrace-common.h Disable record btrace bts support for AMD processors 2020-05-14 17:56:33 -07:00
buffer.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
buffer.h
byte-vector.h
ChangeLog gdb: allow specifying multiple filters when running selftests 2020-08-13 07:55:48 -04:00
check-defines.el Add gdbsupport check-defines script 2020-01-14 16:25:04 -07:00
cleanups.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
cleanups.h
common-debug.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
common-debug.h
common-defs.h gdbsupport: include cstdlib in common-defs.h 2020-04-27 09:28:03 -04:00
common-exceptions.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
common-exceptions.h
common-gdbthread.h
common-inferior.cc gdbsupport: Let construct_inferior_arguments take gdb::array_view param 2020-05-25 11:38:45 -04:00
common-inferior.h gdbsupport: Let construct_inferior_arguments take gdb::array_view param 2020-05-25 11:38:45 -04:00
common-regcache.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
common-regcache.h gdb: protect some 'regcache_read_pc' calls 2020-05-14 13:59:53 +02:00
common-types.h Change gdbsupport not to rely on BFD 2020-03-12 13:32:16 -06:00
common-utils.cc gdbsupport: Drop now unused function 'stringify_argv' 2020-05-25 11:40:35 -04:00
common-utils.h gdbsupport: Drop now unused function 'stringify_argv' 2020-05-25 11:40:35 -04:00
common.m4 Unify Solaris procfs and largefile handling 2020-07-30 15:41:50 +02:00
config.in Unify Solaris procfs and largefile handling 2020-07-30 15:41:50 +02:00
configure Unify Solaris procfs and largefile handling 2020-07-30 15:41:50 +02:00
configure.ac Move sourcing of development.sh to GDB_AC_COMMON 2020-03-12 14:18:00 -04:00
create-version.sh gdbsupport: Resolve shellcheck issues in create-version.sh script 2020-03-27 13:52:00 +00:00
def-vector.h
default-init-alloc.h
enum-flags.h
environ.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
environ.h
errors.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
errors.h Introduce and use flush_streams 2020-04-13 14:10:04 -06:00
event-loop.cc Move gdb_notifier comment 2020-04-13 14:10:04 -06:00
event-loop.h Move event-loop.[ch] to gdbsupport/ 2020-04-13 14:10:04 -06:00
fileio.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
fileio.h
filestuff.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
filestuff.h
filtered-iterator.h
format.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
format.h
forward-scope-exit.h
function-view.h
gdb_assert.h
gdb_binary_search.h Fix two typos in gdb_binary_search.h 2020-03-08 11:05:43 -06:00
gdb_locale.h
gdb_optional.h [gdb/build] Fix Wmaybe-uninitialized in gdb_optional.h 2020-07-28 15:07:44 +02:00
gdb_proc_service.h Ensure proc-service symbols have default visibility (PR build/24805) 2020-01-16 19:14:14 +00:00
gdb_ref_ptr.h Mark move constructors as "noexcept" 2020-04-20 11:45:06 -06:00
gdb_select.h Move gdb_select.h to gdbsupport/ 2020-04-13 14:10:03 -06:00
gdb_setjmp.h
gdb_signals.h
gdb_splay_tree.h
gdb_string_view.h Do not define basic_string_view::to_string 2020-06-30 07:53:03 -06:00
gdb_string_view.tcc
gdb_sys_time.h
gdb_tilde_expand.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
gdb_tilde_expand.h
gdb_unique_ptr.h
gdb_unlinker.h
gdb_vecs.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
gdb_vecs.h
gdb_wait.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
gdb_wait.h
gdb-dlfcn.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
gdb-dlfcn.h Fix comment for 'gdb_dlopen' 2020-02-28 11:04:28 -05:00
gdb-safe-ctype.h Use safe-ctype.h (ISSPACE etc.) in symbol parsing & comparison 2020-05-23 12:46:37 +01:00
gdb-sigmask.h Fix typo (thead -> thread) 2020-04-28 11:38:26 +02:00
hash_enum.h
host-defs.h
job-control.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
job-control.h
Makefile.am Unify Solaris procfs and largefile handling 2020-07-30 15:41:50 +02:00
Makefile.in Unify Solaris procfs and largefile handling 2020-07-30 15:41:50 +02:00
netstuff.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
netstuff.h
new-op.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
next-iterator.h
observable.h
offset-type.h
parallel-for.h
pathstuff.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
pathstuff.h
poison.h
preprocessor.h
print-utils.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
print-utils.h
ptid.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
ptid.h gdb: change regcache list to be a map 2020-08-07 11:29:00 -04:00
README
refcounted-object.h
rsp-low.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
rsp-low.h
run-time-clock.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
run-time-clock.h
safe-iterator.h
safe-strerror.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
scope-exit.h
scoped_fd.h Mark move constructors as "noexcept" 2020-04-20 11:45:06 -06:00
scoped_mmap.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
scoped_mmap.h Mark move constructors as "noexcept" 2020-04-20 11:45:06 -06:00
scoped_restore.h
selftest.cc gdb: allow specifying multiple filters when running selftests 2020-08-13 07:55:48 -04:00
selftest.h gdb: allow specifying multiple filters when running selftests 2020-08-13 07:55:48 -04:00
selftest.m4 Move gdb/selftest.m4 to gdbsupport/selftest.m4 2020-03-12 14:19:38 -04:00
signals-state-save-restore.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
signals-state-save-restore.h
signals.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
symbol.h
tdesc.cc gdb: New maintenance command to print XML target description 2020-06-23 22:17:20 +01:00
tdesc.h gdb/riscv: delete target descriptions when gdb exits 2020-07-17 21:15:32 +01:00
thread-pool.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
thread-pool.h
traits.h
underlying.h
valid-expr.h
version.h
warning.m4 gdb: enable -Wmissing-prototypes warning 2020-03-11 15:15:12 -04:00
x86-xstate.h
xml-utils.cc gdbsupport: rename source files to .cc 2020-02-13 16:27:03 -05:00
xml-utils.h

This is a helper library that is used by gdb and gdbserver.

To send patches, follow the gdb patch submission instructions in
../gdb/CONTRIBUTE.  For maintainers, see ../gdb/MAINTAINERS.