Re: [PATCH v2] Fix logic in exec_file_locate_attach

Gary Benson
2016-02-22T10:40:42Z

Luis Machado wrote:
> On 02/19/2016 09:21 AM, Gary Benson wrote:
> > This is an updated version of the patch I posted yesterday.
> > It fails silently rather than throwing if the executable is
> > not in the sysroot, which both fixes the sysroot-escape issue
> > and results in a better GDB session for the user.
> >
> > Built and regtested on RHEL 6.6 x86_64.
> >
> > Luis, I think this patch will fix your connection drop without
> > any further changes. Could you test it please?
>
> Unfortunately it doesn't completely solve the problem i saw, as
> exec_file_find will still potentially throw errors and will disrupt
> the connection attempt or stop execution of a custom sequence of
> commands (as Pedro noted) when "attach" is part of the sequence.
>
> define foo
> attach <pid>
> >>>> execution stops here if an error is thrown
> info threads
> info registers
> end
>
> It still looks like a TRY/CATCH block is needed around at least
> exec_file_find.

What is throwing in exec_file_find? I'm just seeing lots of calls
to gdb_open_cloexec and openp, and I don't think either of those
should throw except for assertion failures or running out of memory.

Cheers,
Gary

--