This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Limit attempts to place breakpoints on _start, __start, and main in solib-svr4.c
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Kevin Buettner <kevinb at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 2 Dec 2010 00:03:39 +0100
- Subject: Re: [RFC] Limit attempts to place breakpoints on _start, __start, and main in solib-svr4.c
- References: <20101129160233.1265d555@mesquite.lan> <20101130000707.GA26969@host0.dyn.jankratochvil.net> <20101130180618.66003c99@mesquite.lan>
On Wed, 01 Dec 2010 02:06:18 +0100, Kevin Buettner wrote:
> 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".
GNU gdb (GDB) 7.2.50.20101201-cvs
killall -9 gdbserver;sleep 1h&p=$!;sleep 0.1;./gdbserver/gdbserver :1234 ./pause& ./gdb -nx -ex 'file ./pause' -ex 'target remote localhost:1234'
attach_flag=0
- correct
killall -9 gdbserver;./pause&p=$!;sleep 0.1;./gdbserver/gdbserver --attach :1234 $p& ./gdb -nx -ex 'file ./pause' -ex 'target remote localhost:1234'
attach_flag=1
- correct
killall -9 gdbserver;./pause&p=$!;sleep 0.1;./gdbserver/gdbserver --multi :1234& ./gdb -nx -ex 'file ./pause' -ex 'target extended-remote localhost:1234' -ex "attach $p"
attach_flag=1
- correct
Probably in the first case you do not want to place those breakpoints?
But I think at least the "main" breakpoint is the one requested by Mark
Kettenis to stay there even in the case solib_break_names[] bpts fail:
http://sourceware.org/ml/gdb-patches/2010-09/msg00313.html
Maybe the single-hit variant would be enough?
> The patch that I've posted does correctly handle the "target remote"
> case. (It correctly handles the native cases too.)
(The problem is it introduces two variants of "attach_flag".)
Thanks,
Jan