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: [patch] Workaround gcc bug 49906


On Sat, 29 Oct 2011 02:08:04 +0200, Aleksandar Ristovski wrote:
> if we are
> talking about what would be intuitive, then I think the very first
> line of code must be 'for' loop (even if it evaluates to 'nop').
> 
> Consider this test (which is what I was concentrating on):
> 
> (gdb) b foo
> Breakpoint 1 at 0x4004ba: file foo.c, line 8.
> (gdb) list foo
> 1       static int i;
> 2       static void
> 3       foo(void)
> 4       {
> 5         for (;;)
> 6               if (i++)
> 7                 break;
> 8       }
> 9
> 10
> 
> Line 8 is totally unintuitive and weird.

I agree line 8 is wrong, this is what is filed as GCC PR debug/49906.

The question is whether the right line is 6 or whether it should be 5.

If it is 5 with so many nops everywhere I am not sure the debugging is more
comfortable.  IMO when one does "step" one expects some changes in the
inferior happen.


> In any case, I will revisit the whole thing paying attention to your
> test case - maybe there is no generic solution, but then again, I
> would choose the less bad solution over the plain broken one.

It is questionable how hard it should be pushed for in GDB when the right fix
should be done in GCC anyway (I pinged Dodji Seketeli for it yesterday).

My most serious concern is the workaround should not affect any correctly
produced debuginfo (by non-GCC or future GCC compilers).  If there is no other
way than a hack with side-effects then it is IMHO more suitable for vendor
branches of GDB (I make sometimes such hacks in Fedora Rawhide for fresh
GCCs).

There is for example a possibility to make the workaround arch-dependent
finding the last jump instruction and breaking on it, I made a similar
.debug_line workaround recently which should have no side-effects:
	[patch] workaround gcc46: prologue skip skips too far (PR 12435) #2
	http://sourceware.org/ml/gdb-patches/2011-07/msg00645.html


Thanks,
Jan


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