[PATCH 08/16] gdb: move remote arg splitting and joining into gdbsupport/

Andrew Burgess aburgess@redhat.com
Fri Oct 18 15:21:18 GMT 2024


Keith Seitz <keiths@redhat.com> writes:

> On 1/9/24 06:26, Andrew Burgess wrote:
>
>> diff --git a/gdbsupport/remote-args.h b/gdbsupport/remote-args.h
>> new file mode 100644
>> index 00000000000..c0acce9b7c4
>> --- /dev/null
>> +++ b/gdbsupport/remote-args.h
>> @@ -0,0 +1,44 @@
>> +/* Functions to help when passing arguments between GDB and gdbserver.
>> +
>> +   Copyright (C) 2023 Free Software Foundation, Inc.
>> +
>> +   This file is part of GDB.
>> +
>> +   This program is free software; you can redistribute it and/or modify
>> +   it under the terms of the GNU General Public License as published by
>> +   the Free Software Foundation; either version 3 of the License, or
>> +   (at your option) any later version.
>> +
>> +   This program is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +   GNU General Public License for more details.
>> +
>> +   You should have received a copy of the GNU General Public License
>> +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
>> +
>> +namespace gdb
>> +{
>> +
>> +namespace remote_args
>> +{
>> +
>
> I feel like a (generic?) statement about escaping characters would be
> nice to have here. Maybe even just a reference to point folks
> at gdb_argv?

My current proposal is the following comment:

  /* The functions declared here are used when passing inferior arguments
     from GDB to gdbserver.
  
     The remote protocol requires that arguments are passed as a vector of
     separate argument while GDB stores the arguments as a single string, and
     gdbserver also requires the arguments be a single string.
  
     These functions then provide a mechanism to split up an argument string
     and recombine it within gdbserver while preserving escaping of special
     characters within the argument string.  */

You'll be able to review this in context when I post v2 (maybe next week
now).

Thanks,
Andrew



More information about the Gdb-patches mailing list