Re: [PATCH v2] Fix logic in exec_file_locate_attach

Luis Machado
2016-02-23T00:04:58Z

On 02/22/2016 08:00 PM, Pedro Alves wrote:
> On 02/22/2016 10:49 PM, Luis Machado wrote:
>> On 02/22/2016 07:00 PM, Luis Machado wrote:
>
>>> My idea was to guard both exec_file_attach and symbol_file_add_main. We
>>> can't have anything in that function throwing an error that won't be
>>> caught, otherwise the above connection attempt will fail.
>>
>> For the record, you patch does fix the case of native GDB trying to
>> attach to a process without pre-loading a symbol file. We get a
>> multi-frame backtrace as expected.
>>
>> It is the gdb/gdbserver case that still seems to be broken.
>>
>
> Native is also broken as well for unexpectedly aborting the attach
> sequence midway. While "bt" doesn't show it, "detach" does trip on it:
>
> $ ~/gdb/tests/threads&
> [1] 2984
> $ chmod 000 ~/gdb/tests/threads
>
> $ gdb -q
> (gdb) attach 2984
> Attaching to process 2984
> /home/pedro/gdb/tests/threads: Permission denied.
> (gdb) detach
> /home/pedro/gdb/mygit/src/gdb/thread.c:1010: internal-error: is_executing: Assertion `tp' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n)
>
> Thanks,
> Pedro Alves
>

Sounds like we're looking into a try/catch block around such functions then?