]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: move remote arg splitting and joining into gdbsupport/
authorAndrew Burgess <aburgess@redhat.com>
Thu, 9 Nov 2023 14:47:34 +0000 (14:47 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Thu, 24 Apr 2025 15:45:51 +0000 (16:45 +0100)
commitbd036f034b750e101cd072100d54cd8ebb35b7f5
treed830b81a92c202d560e7390eb8d2e56413adb0ad
parent3602da6fa285d6b22d87bcc39056e919e939ef07
gdb: move remote arg splitting and joining into gdbsupport/

This is a refactoring commit.  When passing inferior arguments to
gdbserver we have two actions that need to be performed, splitting and
joining.

On the GDB side, we take the inferior arguments, a single string, and
split the string into a list of individual arguments.  These are then
sent to gdbserver over the remote protocol.

On the gdbserver side we receive the list of individual arguments and
join these back together into a single inferior argument string.

In the next commit I plan to add some unit testing for this remote
argument passing process.  Ideally, for unit testing, we need the code
being tested to be located in some easily callable function, rather
than being inline at the site of use.

So in this commit I propose to move the splitting and joining logic
out into a separate file, we can then use this within GDB and
gdbserver when passing arguments between GDB and gdbserver, but we can
also call the same functions for some unit testing.

In this commit I'm not adding the unit tests, they will be added next,
so for now there should be no user visible changes after this commit.

Tested-By: Guinevere Larsen <guinevere@redhat.com>
gdb/remote.c
gdbserver/server.cc
gdbsupport/Makefile.am
gdbsupport/Makefile.in
gdbsupport/remote-args.cc [new file with mode: 0644]
gdbsupport/remote-args.h [new file with mode: 0644]