Re: Why does gdb stop at a different line than “i b” shows while returning from function?
Joachim Protze
joachim.protze@tu-dresden.de
Fri Aug 3 09:16:00 GMT 2012
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5319 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://sourceware.org/pipermail/gdb/attachments/20120803/11c39878/attachment.p7s>
More information about the Gdb
mailing list