1

When using gdb for debugging some code,it sometimes repeats some code fragments several times while using next command, after this repeat, with the n command, it continues sequentially over program lines normally. What is the reason of this strange behaviour? Or anyone had this problem before? What could be the fix for this? I have GNU gdb (GDB) 7.2-ubuntu.

2
  • A log showing this behavior would be nice, cannot reproduce... Commented Jun 8, 2011 at 20:41
  • not clear what you want from me but most of the time this happens when I try to step into templates, and optimization could be another source... Commented Jun 8, 2011 at 20:45

1 Answer 1

4

Program may have been compiled using optimizations. Try again with -O0 when compiling.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 is that the only reason, I mean to turn on optimisation flags

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.