This is the mail archive of the gdb@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: Single stepping a simple C-program, but...


A Tuesday 20 May 2008 08:11:20, Peter Toft wrote:
> Pedro - your mail is very interesting and very illustrative.
> To be 100% sure that I understand you, and "problem" that we get a line
> counter increment of -1 from 8 to 7 above
> comes from gcc i.e. gdb does the right thing. Do we agree?

Yes.  GDB shows the user what the debug info tells it to.

> Then the question is why gcc does this?!

I don't know.

Based on what I see, the bug is that at -O0, if the predicate
involves subexpressions, the jump at the end of the then block
is attributed to the expression line, while it should be attributed
to the same line as the last statement of the then block -- if that
were so, stepping over the printf call in your example would only
stop at line 12, as expected.

-- 
Pedro Alves


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