From: Daniel Jacobowitz <drow@mvista.com>
To: fnf@ninemoons.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] - Accept optional printed address at function breakpoints
Date: Mon, 08 Dec 2003 16:48:00 -0000 [thread overview]
Message-ID: <20031208164754.GA29159@nevyn.them.org> (raw)
In-Reply-To: <200312081625.hB8GP6vB017846@fred.ninemoons.com>
On Mon, Dec 08, 2003 at 09:25:06AM -0700, Fred Fish wrote:
> I decided to investigate the following failure in funcargs.exp:
>
> FAIL: gdb.base/funcargs.exp: continue to call6k
>
> The problem can reproduced using:
>
> void foo ()
> {
> }
>
> void bar ()
> {
> static int dummy = 0;
> }
>
> main ()
> {
> foo ();
> bar ();
> }
>
> Using x86 native gdb:
>
> $ gcc -g -o x x.c
What GCC version?
> (1) Both functions stop at the same relative position in each of
> foo() and bar(). Gdb is smart enough to break at the first
> instruction after the prologue.
>
> (2) The breakpoint message for bar() does NOT include an address,
> while the one for foo() does contain an address.
This is a debug info bug. Your patch is not correct; when you say
"break LINE" or "break FUNCTION" and there is debug info, it's GDB's
established behavior to stop at the beginning of a line. By not
allowing the address we verify that GDB is stopping at the beginning of
a line as expected.
> 00000000 <foo>:
> foo():
> /build/sourceware/gdb/T-i686-pc-linux-gnu/gdb/x.c:2
> 0: 55 push %ebp
> 1: 89 e5 mov %esp,%ebp
> 3: 5d pop %ebp
> 4: c3 ret
This doesn't tell you anything. Objdump -S will coalesce identical
line notes. You need to look at the debug info. For instance:
08048334 <foo>:
void foo ()
{
8048334: 55 push %ebp
8048335: 89 e5 mov %esp,%ebp
8048337: 5d pop %ebp
8048338: c3 ret
08048339 <bar>:
}
void bar ()
{
8048339: 55 push %ebp
804833a: 89 e5 mov %esp,%ebp
static int dummy = 0;
}
804833c: 5d pop %ebp
804833d: c3 ret
Line Number Statements:
Extended opcode 2: set Address to 0x8048334
Special opcode 6: advance Address by 0 to 0x8048334 and Line by 1 to 2
Special opcode 47: advance Address by 3 to 0x8048337 and Line by 0 to 2
Special opcode 36: advance Address by 2 to 0x8048339 and Line by 3 to 5
Special opcode 49: advance Address by 3 to 0x804833c and Line by 2 to 7
Special opcode 35: advance Address by 2 to 0x804833e and Line by 2 to 9
Special opcode 230: advance Address by 16 to 0x804834e and Line by 1 to 10
Special opcode 76: advance Address by 5 to 0x8048353 and Line by 1 to 11
Special opcode 76: advance Address by 5 to 0x8048358 and Line by 1 to 12
Advance PC by 2 to 804835a
Extended opcode 1: End of Sequence
Notice the special opcode 47 which advances address, but not line? GDB
recognizes that and uses it to find the end of the prologue. If you
haven't got one of those, something is wrong.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-12-08 16:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-08 16:25 Fred Fish
2003-12-08 16:48 ` Daniel Jacobowitz [this message]
2003-12-08 17:51 ` Fred Fish
2003-12-09 4:39 ` Fred Fish
2003-12-08 16:53 Michael Elizabeth Chastain
2003-12-08 18:02 Michael Elizabeth Chastain
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=20031208164754.GA29159@nevyn.them.org \
--to=drow@mvista.com \
--cc=fnf@ninemoons.com \
--cc=gdb-patches@sources.redhat.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