public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/107909] New: [powerpc64le, debug] Incorrect call site location due to nop after call insn
@ 2022-11-29 9:12 vries at gcc dot gnu.org
2022-11-29 9:20 ` [Bug target/107909] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-29 9:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107909
Bug ID: 107909
Summary: [powerpc64le, debug] Incorrect call site location due
to nop after call insn
Product: gcc
Version: 7.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Consider test-case vla-optimized-out.c:
...
int
__attribute__((noinline,weak)) __attribute__((noclone))
f1 (int i)
{
char a[i + 1];
a[0] = 5;
return a[0];
}
int
main (void)
{
volatile int j;
int i = 5;
asm volatile ("" : "=r" (i) : "0" (i));
j = f1 (i);
return 0;
}
...
compiled with -O1 -g.
We generate a nop after the bl insn:
...
bl f1 # 11 *call_value_nonlocal_aixdi [length = 8]
nop
.LVL4:
...
and the label after the nop is a call site location:
...
.uleb128 0x5 # (DIE (0x67) DW_TAG_GNU_call_site)
.8byte .LVL4 # DW_AT_low_pc
.4byte 0x81 # DW_AT_abstract_origin
...
Consequently we can't actually find the call site:
...
$ gdb -q -batch ./a.out -ex "break f1" -ex run -ex "set debug entry-values 1"
-ex "print sizeof (a)"
Breakpoint 1 at 0x1000065c: file vla-optimized-out.c, line 8.
Breakpoint 1, f1 (i=5) at vla-optimized-out.c:8
8 }
DW_OP_entry_value resolving cannot find DW_TAG_call_site 0x10000690 in main
$1 = <optimized out>
...
If we manually fix this in the .s file, we get a bit further:
...
$ gdb -q -batch ./a.out -ex "break f1" -ex run -ex "set debug entry-values 1"
-ex "print sizeof (a)"
Breakpoint 1 at 0x1000065c: file vla-optimized-out.c, line 8.
Breakpoint 1, f1 (i=5) at vla-optimized-out.c:8
8 }
Cannot find matching parameter at DW_TAG_call_site 0x10000690 at main
$1 = <optimized out>
...
The problem now is that the DW_AT_abstract_origin in the DW_TAG_GNU_call_site
is not properly handled by gdb.
I reproduced this with gcc 7.5.0, but after looking at the pattern for
call_value_nonlocal_aixdi I think this should be reproducible with trunk.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/107909] [powerpc64le, debug] Incorrect call site location due to nop after call insn
2022-11-29 9:12 [Bug debug/107909] New: [powerpc64le, debug] Incorrect call site location due to nop after call insn vries at gcc dot gnu.org
@ 2022-11-29 9:20 ` pinskia at gcc dot gnu.org
2022-11-29 9:24 ` pinskia at gcc dot gnu.org
2022-11-29 9:25 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-29 9:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107909
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/legacy-ml/gcc-patches/2010-08/txt00153.txt for the
description of the call site dwarf.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/107909] [powerpc64le, debug] Incorrect call site location due to nop after call insn
2022-11-29 9:12 [Bug debug/107909] New: [powerpc64le, debug] Incorrect call site location due to nop after call insn vries at gcc dot gnu.org
2022-11-29 9:20 ` [Bug target/107909] " pinskia at gcc dot gnu.org
@ 2022-11-29 9:24 ` pinskia at gcc dot gnu.org
2022-11-29 9:25 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-29 9:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107909
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, the nop is required by the ABI because the TOC might be different and
replaced with a load during linking ...
I am not 100% sure this is not just a definition of DW_TAG_GNU_call_site for
powerpc64 ABIs really. Since DW_TAG_GNU_call_site is an GNU extension I would
assume we can still define it for PowerPC64 (and powerpc-aix) any way we want
to define it. That is define it to be the instruction after the TOC update.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug target/107909] [powerpc64le, debug] Incorrect call site location due to nop after call insn
2022-11-29 9:12 [Bug debug/107909] New: [powerpc64le, debug] Incorrect call site location due to nop after call insn vries at gcc dot gnu.org
2022-11-29 9:20 ` [Bug target/107909] " pinskia at gcc dot gnu.org
2022-11-29 9:24 ` pinskia at gcc dot gnu.org
@ 2022-11-29 9:25 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-29 9:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107909
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh wait DW_TAG_call_site is now part of dwarf5. maybe the powerpc ABI can
define it that way then ...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-29 9:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 9:12 [Bug debug/107909] New: [powerpc64le, debug] Incorrect call site location due to nop after call insn vries at gcc dot gnu.org
2022-11-29 9:20 ` [Bug target/107909] " pinskia at gcc dot gnu.org
2022-11-29 9:24 ` pinskia at gcc dot gnu.org
2022-11-29 9:25 ` pinskia at gcc dot gnu.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).