This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] add-inferior: expand tilde in -exec FILENAME argument


Hi, sorry for the delay in getting back to this.

On 02/28/2013 05:15 PM, Agovic, Sanimir wrote:
>> -----Original Message-----
>> From: Pedro Alves [mailto:palves@redhat.com]
>> Sent: Thursday, February 28, 2013 04:33 PM
> 
> Thanks for your feedback.
> 
>> I assume this fixes:
>>
>> (gdb) add-inferior -exec ~/gdb/tests/main
>> Added inferior 2
>> ~/gdb/tests/main: No such file or directory.
>>
>> even though the file does exist.
> Yes. Sorry for not being clear about the cause.
> 
>> I wondered if other similar places expand the tilde early
>> or just before file open [...]
> I found at least one another case:
> 
> % gdb -batch \~/gdb/tests/main  # or --exec=~/gdb/tests/main
> ~/gdb/tests/main: No such file or directory.
> 
> Whereas:
> % gdb -batch --symbols=\~/gdb/tests/main
> Succeeds.
> 
> Seems like gdb relies on the shell to expand its executable name.
> 
> As an alternative approach I can expand tilde in exec_file_attach
> which is what symbol_file_add and core_file_command do.

Yes, I think that makes sense.  We could then remove it from exec.c:

      filename = tilde_expand (*argv);
      make_cleanup (xfree, filename);
      exec_file_attach (filename, from_tty);

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]