Re: [PATCH v2] Fix logic in exec_file_locate_attach

Gary Benson
2016-02-23T12:15:19Z

Pedro Alves wrote:
> On 02/23/2016 11:27 AM, Gary Benson wrote:
> > I hadn't considered user interrupts.
>
> But there's nothing about user interrupts in either of:
>
> https://sourceware.org/ml/gdb-patches/2016-02/msg00511.html
>
> or:
>
> https://sourceware.org/ml/gdb-patches/2016-02/msg00671.html
>
> That is about gdb managing to figure out the file name of the
> running program, but then trying to open the file, and that failing
> and throwing.

Sure. But up until now I've been thinking my way through the cases in
the exec_file_locate_attach in terms of file accessibility checks, and
the possibility of user interrupts makes that irrelevent.

I'm not averse to TRY..CATCH, in fact I think the suggestion of two
separate TRY..CATCH blocks around exec_file_attach the symbol file
one is the correct solution.

But, there is a separate issue, which is that if you run gdbserver on
some executable, and GDB has a sysroot set, and that executable does
not exist in GDB's sysroot but does exist on GDB's root filesystem,
then GDB will open the file from its root filesystem:

gdb -ex "set sysroot /xxx" -ex "target remote | gdbserver - /bin/ls"
...
Reading symbols from /bin/ls...(no debugging symbols found)...done.

My v2 patch stops that. So... can I commit it?

Cheers,
Gary

--