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: [RFC] Limit attempts to place breakpoints on _start, __start, and main in solib-svr4.c


On Tue, 30 Nov 2010 01:07:07 +0100
Jan Kratochvil <jan.kratochvil@redhat.com> wrote:

> > -enable_break (struct svr4_info *info, int from_tty)
> > +enable_break (struct svr4_info *info, int from_tty, int from_run_command)
> 
> I haven't tried it myself but is there a reason why not to use
> `struct inferior->attach_flag' instead?

Hi Jan,

This appeared to be a very promising suggestion.  One of the things
that I find unfortunate about my patch is that it touches more code
than I'd like.  Therefore, I was excited when you suggested the use
of `attach_flag' because it'd reduce that multi-page patch that I
posted to just a few lines.

My testing shows that use of `! current_inferior ()->attach_flag' as
the test in enable_break() works when attaching to a process started
natively.  I also see the correct behavior (in which a breakpoint is
placed on _start, et al) when the process is started via GDB's
"run" command.

The case that doesn't work - and, unfortunately, it's the case that
really matters to me - is connecting to a remote target via "target
remote".  A cursory glance at remote.c shows that `attach_flag' is set
appropriately in several places, but a somewhat deeper analysis
reveals that post_create_inferior() (which, for svr4 shared libs,
eventually calls enable_break()) is called well in advance of the
code which sets `attach_flag'.  Bummer.

The patch that I've posted does correctly handle the "target remote"
case.  (It correctly handles the native cases too.)

Kevin


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