Strange effect in GDB 6.8 when setting breakpoint on symbol with both strong and weak definitions

Antony KING
Tue Oct 14 20:31:00 GMT 2008

Daniel Jacobowitz wrote:
> On Tue, Oct 14, 2008 at 02:23:52PM +0100, Antony KING wrote:
>> As you can see the location of the breakpoint at f() has been shifted
>> from its definition in b.c (which is what I expected) before the program
>> is run, to its definition in a.c after the program stopped in main()
>> (which is not what I would expect). This shift of location seems wrong
>> to me and quite unexpected. Is this a bug ?
> I don't know why this happens.

I have also just tried this with the CVS HEAD of GDB with the same
result. Could it be that GDB is re-evaluating the breakpoint after the
program is launched (since it is a pending breakpoint) and a different
instance of f() being found ?

BTW when I use our build of GDB 6.8 for use with remote SH-4 targets I
do not see this "shift" of breakpoint location.

Anyway, I think I will submit this behaviour as a bug.

>> Another problem is that although there are 2 definitions of f() in the
>> program, only 1 breakpoint is being set. My understanding is that GDB
>> should set multiple breakpoints on f(). Is this correct (or is this only
>> a feature that is enabled when debugging C++ applications) ?
> It would be nice if this worked, but it doesn't; so far it's only
> based on line number.  So it works for inlined or templated code.

OK. I do not remember seeing anything recently on the GDB list about
this, but is this an area being looked at as a future enhancement ?

More information about the Gdb mailing list