diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2020-08-14 12:27:22 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-08-14 12:27:22 -0400 |
commit | d369b608a1fc84813762e71a40a6cafb3ab828fe (patch) | |
tree | 65ec08506192d4cc54c9f49b11a7243b66863457 /gdb/maint.c | |
parent | 19bddbe95c156a4883213a57d4437b75318b6875 (diff) | |
download | gdb-d369b608a1fc84813762e71a40a6cafb3ab828fe.zip gdb-d369b608a1fc84813762e71a40a6cafb3ab828fe.tar.gz gdb-d369b608a1fc84813762e71a40a6cafb3ab828fe.tar.bz2 |
gdb: add gdb_argv::as_array_view method
Introduce the gdb_argv::as_array_view method, as a way to easily pass
the parsed arguments array to a function taking an array view. There is
currently one caller where we can use this (which prompted the
suggestion to implement this method).
Add some selftests for the new method, which at the same time test a
little bit gdb_argv. As far as I know, it's not tested currently.
gdb/ChangeLog:
* utils.h (class gdb_argv) <as_array_view>: New method.
* utils.c (gdb_argv_as_array_view_test): New.
(_initialize_utils): Register selftest.
* maint.c (maintenance_selftest): Use the new method.
Change-Id: I0645037613ed6549aabe60f14a36f3494513b177
Diffstat (limited to 'gdb/maint.c')
-rw-r--r-- | gdb/maint.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/maint.c b/gdb/maint.c index fd37acc..3368769 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -1042,7 +1042,7 @@ maintenance_selftest (const char *args, int from_tty) { #if GDB_SELF_TEST gdb_argv argv (args); - selftests::run_tests (gdb::array_view<char *> (argv.get (), argv.count ())); + selftests::run_tests (argv.as_array_view ()); #else printf_filtered (_("\ Selftests have been disabled for this build.\n")); |