public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "yangyibiao at nju dot edu.cn" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/29236] New: wrong mapping between address and source line
Date: Thu, 09 Jun 2022 17:09:04 +0000 [thread overview]
Message-ID: <bug-29236-4717@http.sourceware.org/bugzilla/> (raw)
https://sourceware.org/bugzilla/show_bug.cgi?id=29236
Bug ID: 29236
Summary: wrong mapping between address and source line
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: yangyibiao at nju dot edu.cn
Target Milestone: ---
$ gcc --version
gcc (GCC) 13.0.0 20220608 (experimental)
$ gdb --version
GNU gdb (GDB) 13.0.50.20220608-git
$ cat small.c
char *pa;
char *pb;
void access (volatile char *ptr) { *ptr = 'x'; }
int main (int argc, char **argv)
{
char a, b;
pa = &a;
pb = &b;
access (pa);
access (pb);
return 0;
}
$ gcc -O2 -g small.c; gdb -q a.out
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x401020: file small.c, line 10.
(gdb) r
Starting program: /root/a.out
Breakpoint 1, main (argc=1, argv=0x7fffffffe4f8) at small.c:10
10 pa = &a;
(gdb) s
13 access (pa);
(gdb) bt -frame-info location-and-address
#0 0x0000000000401025 in main (argc=1, argv=0x7fffffffe4f8) at small.c:13
(gdb) maint info line-table
objfile: /root/a.out ((struct objfile *) 0x20d7c60)
compunit_symtab: small.c ((struct compunit_symtab *) 0x216ac40)
symtab: /root/small.c ((struct symtab *) 0x216acc0)
linetable: ((struct linetable *) 0x21cb060):
INDEX LINE ADDRESS IS-STMT PROLOGUE-END
0 7 0x0000000000401020 Y
1 8 0x0000000000401020 Y
2 10 0x0000000000401020 Y
3 10 0x0000000000401020
4 4 0x0000000000401025
5 10 0x000000000040102a
6 11 0x0000000000401031 Y
7 11 0x0000000000401031
8 13 0x000000000040103d Y
9 4 0x000000000040103d Y
10 4 0x000000000040103d Y
11 4 0x000000000040103d
12 14 0x000000000040103d Y
13 4 0x000000000040103d Y
14 4 0x000000000040103d Y
15 17 0x000000000040103d
16 4 0x000000000040103f
17 4 0x0000000000401044
18 16 0x0000000000401044 Y
19 17 0x0000000000401044
20 END 0x0000000000401045 Y
21 4 0x0000000000401140 Y
22 4 0x0000000000401140 Y
23 4 0x0000000000401140
24 4 0x0000000000401143
25 END 0x0000000000401144 Y
(gdb)
======================================================================
= As we can find from the line-table, line 4 is only maps to the address of
0x0000000000401025 and the "IS-STMT" for line 13 is "Y"(yes).
= However, the backtrace reports that this address of 0x0000000000401025 is at
line 13 as "#0 0x0000000000401025 in main (argc=1, argv=0x7fffffffe4f8) at
small.c:13".
= I was wondering that this might be a gdb issue.
======================================================================
--
You are receiving this mail because:
You are on the CC list for the bug.
next reply other threads:[~2022-06-09 17:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 17:09 yangyibiao at nju dot edu.cn [this message]
2022-06-09 17:09 ` [Bug symtab/29236] " yangyibiao at nju dot edu.cn
2022-06-09 17:09 ` yangyibiao at nju dot edu.cn
2022-06-12 16:05 ` tromey at sourceware dot org
2024-01-11 19:34 ` ssbssa at sourceware dot org
2024-10-14 15:45 ` [Bug symtab/29236] [gdb] make viewpoints at same address explicit vries at gcc dot gnu.org
2024-10-14 17:32 ` sam at gentoo dot org
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=bug-29236-4717@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=gdb-prs@sourceware.org \
/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).