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
This commit is contained in:
parent
8c2999954b
commit
c0492bea7c
3 changed files with 27 additions and 3 deletions
11
gdb/maint.c
11
gdb/maint.c
|
@ -1176,8 +1176,15 @@ maintenance_selftest_completer (cmd_list_element *cmd,
|
|||
{
|
||||
auto grp = make_maintenance_selftest_option_group (nullptr);
|
||||
|
||||
gdb::option::complete_options
|
||||
(tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp);
|
||||
if (gdb::option::complete_options
|
||||
(tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
|
||||
return;
|
||||
|
||||
selftests::for_each_selftest ([&tracker, text] (const std::string &name)
|
||||
{
|
||||
if (startswith (name.c_str (), text))
|
||||
tracker.add_completion (make_unique_xstrdup (name.c_str ()));
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue