aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-11-19 15:24:59 +0000
committerAndrew Burgess <aburgess@redhat.com>2026-02-13 16:37:38 +0000
commit7de2cbde437a37aae1b8eb8da7718e5179187dda (patch)
treef26828137310ade8a1f29245256d1f571cdad66b /gdb/python
parent51b7445c65ff06a6d9740fc635be73287527a0a5 (diff)
downloadbinutils-7de2cbde437a37aae1b8eb8da7718e5179187dda.tar.gz
binutils-7de2cbde437a37aae1b8eb8da7718e5179187dda.tar.bz2
binutils-7de2cbde437a37aae1b8eb8da7718e5179187dda.zip
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 <tom@tromey.com>
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-inferior.c7
1 files changed, 2 insertions, 5 deletions
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<char *> argvec;
- for (const auto &arg : args)
- argvec.push_back (arg.get ());
- gdb::array_view<char * const> view (argvec.data (), argvec.size ());
- inf->inferior->set_args (view, true);
+ gdb::array_view<gdb::unique_xmalloc_ptr<char> const> args_view (args);
+ inf->inferior->set_args (args_view, true);
}
else
{