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: Why does gdb stop at a diff erent line than “i b” shows while ret urning from function?


On 29.07.2012 20:54, wempwer@gmail.com wrote:
> Here is the program I am trying to debug:
>
> [...]
>
> This code is coming from here http://www.dirac.org/linux/gdb/05-Stepping_And_Resuming.php#breakpointsandwatchpoints26. 
The original code with forward decl of display compiles without warning ;)
> It was supposed to stop at line 8 in main() but it stopped at line 9 it main(). For me it's misleading. I think it should stop at line 9, because this is what 'break' commands does - sets a break point at the very next instruction. But why "info breakpoints" said that the break point was set at line 8?
The behaviour is similar with setting a breakpoint at empty line 7 ("b
7") or function header line 13 ("b 13"): "i b" shows try5.c:7 resp.
try5.c:13, but the program stops at line 8 resp. 15.

The thing gets even fancier, when you rerun the program after setting
the breakpoints: Now "i b" lists your breakpoint at line 9, while my
breakpoints remain at line 7 resp. 13.

- Joachim

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


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