[PATCH 4/4] gdbsupport: rewrite gdb_argv to use extract_string_maybe_quoted

Tom Tromey tom@tromey.com
Fri Feb 9 17:22:44 GMT 2024


>>>>> "Andrew" == Andrew Burgess <aburgess@redhat.com> writes:

>> That said, I'm also in favor of gdb moving away from using buildargv.

Andrew> If I simplify extract_string_maybe_quoted as you suggest on patch #2
Andrew> then I'll not be able to share that here.  I'm going to rework the first
Andrew> 3 patches, and see how this leaves this patch looking.

If my suggestion causes problems, it's fine to push back... I wouldn't
want a sort of offhand thought to make more work.

Andrew> Maybe.  One place we use gdb_argv is when we start an inferior without a
Andrew> shell, in which case we forward the gdb_argv data to the exec call (so
Andrew> we need a nullptr terminated array of C strings).  But that's just one
Andrew> of _many_ uses of gdb_argv, so maybe we should specialise that case in
Andrew> some way, and all the other uses could use the vector of strings.

For this particular case we could have some method to return a transient
vector of 'const char *' or something along those lines.  To be clear
I'm not suggesting you do anything like this in your series, I was just
pointing out why I think it'd be good to move off of buildargv.

Tom


More information about the Gdb-patches mailing list