aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/selftest.h
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-04-19gdbsupport/selftest: Allow lazy registrationLancelot SIX1-0/+11
This patch adds a way to delay the registration of tests until the latest possible moment. This is intended for situations where GDB needs to be fully initialized in order to decide if a particular selftest can be executed or not. This mechanism will be used in the next patch. Change-Id: I7f6b061f4c0a6832226c7080ab4e3a2523e1b0b0
2022-04-19gdbsupport/selftest: Replace for_each_selftest with an iterator_rangeLancelot SIX1-7/+24
Remove the callback-based selftests::for_each_selftest function and use an iterator_range instead. Also use this iterator range in run_tests so all iterations over the selftests are done in a consistent way. This will become useful in a later commit. Change-Id: I0b3a5349a7987fbcb0071f11c394e353df986583
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-10-28gdb: add selftest name completionSimon Marchi1-1/+3
After the previous commit, it is easy to add completion for selftest names. Again, this is not particularly high value, but I rarely touched completion, so it served as a simple example to get some practice. Change the for_each_selftest_ftype parameter to gdb::function_view, so that we can pass a lambda that captures things. Change-Id: I87cac299ddca9ca7eb0ffab78342e850a98d954c
2021-10-19Always use std::function for self-testsTom Tromey1-14/+0
Now that there is a register_test variant that accepts std::function, it seems to me that the 'selftest' struct and accompanying code is obsolete -- simply always using std::function is simpler. This patch implements this idea.
2021-09-22[gdb] Add maint selftest -verbose optionTom de Vries1-1/+6
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.
2021-09-21[gdb] Change register_test to use std::function argTom de Vries1-1/+1
Change register_test to use std::function arg, such that we can do: ... register_test (test_name, [=] () { SELF_CHECK (...); }); ... Tested on x86_64-linux.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-08-13gdb: allow specifying multiple filters when running selftestsSimon Marchi1-3/+5
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-01-14Move gdbsupport to the top levelTom Tromey1-0/+73
This patch moves the gdbsupport directory to the top level. This is the next step in the ongoing project to move gdbserver to the top level. The bulk of this patch was created by "git mv gdb/gdbsupport gdbsupport". This patch then adds a build system to gdbsupport and wires it into the top level. Then it changes gdb to use the top-level build. gdbserver, on the other hand, is not yet changed. It still does its own build of gdbsupport. ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * src-release.sh (GDB_SUPPORT_DIRS): Add gdbsupport. * MAINTAINERS: Add gdbsupport. * configure: Rebuild. * configure.ac (configdirs): Add gdbsupport. * gdbsupport: New directory, move from gdb/gdbsupport. * Makefile.def (host_modules, dependencies): Add gnulib. * Makefile.in: Rebuild. gdb/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * nat/x86-linux-dregs.c: Include configh.h. * nat/linux-ptrace.c: Include configh.h. * nat/linux-btrace.c: Include configh.h. * defs.h: Include config.h, bfd.h. * configure.ac: Don't source common.host. (CONFIG_OBS, CONFIG_SRCS): Remove gdbsupport files. * configure: Rebuild. * acinclude.m4: Update path. * Makefile.in (SUPPORT, LIBSUPPORT, INCSUPPORT): New variables. (CONFIG_SRC_SUBDIR): Remove gdbsupport. (INTERNAL_CFLAGS_BASE): Add INCSUPPORT. (CLIBS): Add LIBSUPPORT. (CDEPS): Likewise. (COMMON_SFILES): Remove gdbsupport files. (HFILES_NO_SRCDIR): Likewise. (stamp-version): Update path to create-version.sh. (ALLDEPFILES): Remove gdbsupport files. gdb/gdbserver/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * server.h: Include config.h. * gdbreplay.c: Include config.h. * configure: Rebuild. * configure.ac: Don't source common.host. * acinclude.m4: Update path. * Makefile.in (INCSUPPORT): New variable. (INCLUDE_CFLAGS): Add INCSUPPORT. (SFILES): Update paths. (version-generated.c): Update path to create-version.sh. (gdbsupport/%-ipa.o, gdbsupport/%.o): Update paths. gdbsupport/ChangeLog 2020-01-14 Tom Tromey <tom@tromey.com> * common-defs.h: Add GDBSERVER case. Update includes. * acinclude.m4, aclocal.m4, config.in, configure, configure.ac, Makefile.am, Makefile.in, README: New files. * Moved from ../gdb/gdbsupport/ Change-Id: I07632e7798635c1bab389bf885971e584fb4bb78