public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/29236] New: wrong mapping between address and source line
@ 2022-06-09 17:09 yangyibiao at nju dot edu.cn
2022-06-09 17:09 ` [Bug symtab/29236] " yangyibiao at nju dot edu.cn
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-06-09 17:09 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/29236] wrong mapping between address and source line
2022-06-09 17:09 [Bug symtab/29236] New: wrong mapping between address and source line yangyibiao at nju dot edu.cn
@ 2022-06-09 17:09 ` yangyibiao at nju dot edu.cn
2022-06-09 17:09 ` yangyibiao at nju dot edu.cn
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-06-09 17:09 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29236
Yibiao Yang <yangyibiao at nju dot edu.cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/29236] wrong mapping between address and source line
2022-06-09 17:09 [Bug symtab/29236] New: wrong mapping between address and source line yangyibiao at nju dot edu.cn
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
3 siblings, 0 replies; 5+ messages in thread
From: yangyibiao at nju dot edu.cn @ 2022-06-09 17:09 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29236
Yibiao Yang <yangyibiao at nju dot edu.cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yangyibiao at nju dot edu.cn
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/29236] wrong mapping between address and source line
2022-06-09 17:09 [Bug symtab/29236] New: wrong mapping between address and source line yangyibiao at nju dot edu.cn
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
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-06-12 16:05 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29236
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-06-12
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Looks like a bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug symtab/29236] wrong mapping between address and source line
2022-06-09 17:09 [Bug symtab/29236] New: wrong mapping between address and source line yangyibiao at nju dot edu.cn
` (2 preceding siblings ...)
2022-06-12 16:05 ` tromey at sourceware dot org
@ 2024-01-11 19:34 ` ssbssa at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-11 19:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29236
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
As far as I can tell this is part of gdb's magic to make debugging of inline
functions easier to follow.
I've different addresses, but I get a similar result:
```
(gdb) s
13 access (pa);
(gdb) bt -frame-info location-and-address
#0 0x000000013f96253e in main (argc=<optimized out>, argv=<optimized out>) at
gdb-29236.c:13
(gdb) maint info line-table gdb-29236.c
INDEX LINE REL-ADDRESS UNREL-ADDRESS IS-STMT PROLOGUE-END
...
12 4 0x000000013f96253e 0x000000014000253e
```
And then, I step again:
```
(gdb) s
0x000000013f96253e in access (ptr=<optimized out>) at gdb-29236.c:4
4 void access (volatile char *ptr) { *ptr = 'x'; }
(gdb) bt -frame-info location-and-address
#0 0x000000013f96253e in access (ptr=<optimized out>) at gdb-29236.c:4
#1 0x000000013f96253e in main (argc=<optimized out>, argv=<optimized out>) at
gdb-29236.c:13
```
The address stays the same, so gdb didn't really step, but just faked this for
the user.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-11 19:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 17:09 [Bug symtab/29236] New: wrong mapping between address and source line yangyibiao at nju dot edu.cn
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
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).