aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/selftest.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-09-23 09:56:51 -0400
committerSimon Marchi <simon.marchi@efficios.com>2021-10-28 11:17:45 -0400
commitc0492bea7ca33fafc280f08f4ed9f505d29e7130 (patch)
tree573f368c19b8c952d10b85deb697296d0822a263 /gdbsupport/selftest.h
parent8c2999954bd3aa5853f553eb6a050dd38e6d9029 (diff)
downloadgdb-c0492bea7ca33fafc280f08f4ed9f505d29e7130.zip
gdb-c0492bea7ca33fafc280f08f4ed9f505d29e7130.tar.gz
gdb-c0492bea7ca33fafc280f08f4ed9f505d29e7130.tar.bz2
gdb: add selftest name completion
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
Diffstat (limited to 'gdbsupport/selftest.h')
-rw-r--r--gdbsupport/selftest.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdbsupport/selftest.h b/gdbsupport/selftest.h
index 2326eba..7275126 100644
--- a/gdbsupport/selftest.h
+++ b/gdbsupport/selftest.h
@@ -20,6 +20,7 @@
#define COMMON_SELFTEST_H
#include "gdbsupport/array-view.h"
+#include "gdbsupport/function-view.h"
/* A test is just a function that does some checks and throws an
exception if something has gone wrong. */
@@ -48,7 +49,8 @@ extern void run_tests (gdb::array_view<const char *const> filters,
/* Reset GDB or GDBserver's internal state. */
extern void reset ();
-typedef void for_each_selftest_ftype (const std::string &name);
+using for_each_selftest_ftype
+ = gdb::function_view<void(const std::string &name)>;
/* Call FUNC for each registered selftest. */