public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Joachim Protze <joachim.protze@tu-dresden.de>
To: wempwer@gmail.com
Cc: gdb@sourceware.org
Subject: Re: Why does gdb stop at a different line than “i b” shows while returning from function?
Date: Fri, 03 Aug 2012 09:16:00 -0000	[thread overview]
Message-ID: <501B96BE.8050604@tu-dresden.de> (raw)
In-Reply-To: <20120729185452.GB2732@a.lan>

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

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 #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5319 bytes --]

  reply	other threads:[~2012-08-03  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29 18:02 wempwer
2012-08-03  9:16 ` Joachim Protze [this message]
2012-08-04 19:09   ` wempwer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=501B96BE.8050604@tu-dresden.de \
    --to=joachim.protze@tu-dresden.de \
    --cc=gdb@sourceware.org \
    --cc=wempwer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).