This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Fix logic in exec_file_locate_attach
- From: Gary Benson <gbenson at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org, Pedro Alves <palves at redhat dot com>
- Date: Mon, 22 Feb 2016 13:51:09 +0000
- Subject: Re: [PATCH v2] Fix logic in exec_file_locate_attach
- Authentication-results: sourceware.org; auth=none
- References: <20160219102447 dot GA29870 at blade dot nx> <1455880879-310-1-git-send-email-gbenson at redhat dot com> <56C736ED dot 9040505 at codesourcery dot com> <20160222104034 dot GA31531 at blade dot nx> <56CAF2E3 dot 7050607 at codesourcery dot com>
Luis Machado wrote:
> On 02/22/2016 07:40 AM, Gary Benson wrote:
> > 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.
>
> Not sure why i had exec_file_find in my mind. I meant to say
> exec_file_attach still throws errors, when openp fails and
> scratch_chan < 0. Sorry.
You shouldn't get that now, the "if (full_exec_path == NULL) return"
should have caught it. Are you still seeing thrown errors with your
setup?
> There is a symbol_file_add_main call right after calling
> exec_file_attach in exec_file_locate_attach, but i didn't see any
> errors being thrown from that one.
You could probably race it (e.g. by deleting the file between the
calls) but generally symbol_file_add_main won't fail because
exec_file_attach would have failed if the file was missing or
inaccessible.
Cheers,
Gary
--
http://gbenson.net/