From 7de2cbde437a37aae1b8eb8da7718e5179187dda Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Sun, 19 Nov 2023 15:24:59 +0000 Subject: gdb/gdbserver: move argument setting complexity into gdbsupport/ This commit removes some uses of gdb::argv_vec from GDB. The gdb::argv_vec class exists in part due to our need to convert from one container type to another in a few places, and I think by using templates we can push this conversion down into gdbsupport/common-inferior.{cc,h} and remove the conversion logic from higher level code in GDB. This should make core GDB simpler. For examples of this simplification, see python/py-inferior.c, remote.c, and unittests/remote-arg-selftests.c, where this commit has allowed for the removal of some code that only exists in order to convert the container type. Ideally I'd like to see all uses of gdb::argv_vec removed, but I'm still not sure about the use in nat/fork-inferior.c, I think its use there might be the best solution, so for now at least, I have no plans to touch that code. There should be no user visible changes after this commit. Approved-By: Tom Tromey --- gdb/python/py-inferior.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index 69a7bfa3c37..53f3344429d 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -905,11 +905,8 @@ infpy_set_args (PyObject *self, PyObject *value, void *closure) return -1; args.push_back (std::move (str)); } - std::vector argvec; - for (const auto &arg : args) - argvec.push_back (arg.get ()); - gdb::array_view view (argvec.data (), argvec.size ()); - inf->inferior->set_args (view, true); + gdb::array_view const> args_view (args); + inf->inferior->set_args (args_view, true); } else { -- cgit v1.2.3