[PATCH v3 5/5] Extend "set cwd" to work on gdbserver

Eli Zaretskii eliz@gnu.org
Sat Sep 23 06:00:00 GMT 2017


> From: Sergio Durigan Junior <sergiodj@redhat.com>
> Cc: gdb-patches@sourceware.org,  palves@redhat.com
> Date: Fri, 22 Sep 2017 16:47:26 -0400
> 
> > GDB does know about target-charset and host-charset.  I'd expect file
> > names that are sent to the target be in the target charset, but since
> > what get_inferior_cwd returns is in host charset (it was typed by the
> > user), I think a conversion might be in order.
> 
> I don't know.  We never seem to do that in other cases.  For example,
> when we are starting the inferior remotely:
> 
>   static int
>   extended_remote_run (const std::string &args)
>   {
>     ...
>     if (strlen (remote_exec_file) * 2 + len >= get_remote_packet_size ())
>       error (_("Remote file name too long for run packet"));
>     len += 2 * bin2hex ((gdb_byte *) remote_exec_file, rs->buf + len,
>                         strlen (remote_exec_file));
> 
> 
> The "remote_exec_file" variable is also something that the user inputs
> through the "set remote exec-file" command.  It doesn't seem like we
> need to worry about charset conversion here.

If remote_exec_file came from the target, that's okay, as it would be
already in the target charset.  But if it is typed by the user, then I
guess we indeed have such problems, when the 2 charsets are different.

Anyway, I don't want to block the changeset or hijack the discussions.
Feel free to go ahead with pushing if we generally ignore this issue
elsewhere.

Thanks.



More information about the Gdb-patches mailing list