public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
@ 2022-11-21 12:49 vries at gcc dot gnu.org
2022-11-21 12:56 ` [Bug testsuite/29813] " vries at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-21 12:49 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29813
Bug ID: 29813
Summary: [gdb/testsuite, powerpc64le] FAIL:
gdb.base/vla-optimized-out.exp: o1: printed size of
optimized out vla
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: testsuite
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
On powerpc64le, with gcc 7.5.0, I run into:
...
(gdb) PASS: gdb.base/vla-optimized-out.exp: o1: printed optimized out vla
p sizeof (a)^M
$2 = <optimized out>^M
(gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out
vla
...
The dwarf expression that needs evaluating is:
...
<155> DW_AT_upper_bound : 13 byte block: f3 1 53 23 1 8 20 24 8 20 26 31
1c (DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)); DW_OP_plus_uconst: 1;
DW_OP_const1u: 32; DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra; DW_OP_lit1;
DW_OP_minus)
...
I suppose the following happens. The DW_OP_GNU_entry_value needs to be
evaluated, and gdb looks for a call site matching this pc:
...
(gdb) up
#1 0x0000000010000690 in main () at
gdb/testsuite/gdb.base/vla-optimized-out.c:42
42 j = f1 (i);
(gdb)
...
There is a call site here:
...
<2><f6>: Abbrev Number: 5 (DW_TAG_GNU_call_site)
<f7> DW_AT_low_pc : 0x10000694
<ff> DW_AT_abstract_origin: <0x110>
...
which is not matched because it's 0x4 off.
Looking at the .s file:
...
bl f1 # 11 *call_value_nonlocal_aixdi [length = 8]
nop
.LVL4:
...
it becomes clear what happened.
The pc label for the call site:
...
.uleb128 0x5 # (DIE (0x67) DW_TAG_GNU_call_site)
.8byte .LVL4 # DW_AT_low_pc
.4byte 0x81 # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0x2d
...
comes after the nop, and it should come before.
FWIW, in principle, gdb could do better, because it could look at the pc:
...
(gdb) p /x $pc
$1 = 0x1000065c
...
and conclude that it's the start of the function:
...
(gdb) disassemble f1
Dump of assembler code for function f1:
=> 0x000000001000065c <+0>: li r3,5
0x0000000010000660 <+4>: blr
0x0000000010000664 <+8>: .long 0x0
0x0000000010000668 <+12>: .long 0x0
0x000000001000066c <+16>: .long 0x0
End of assembler dump.
...
and therefore DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)) == DW_OP_reg3:
...
(gdb) p $r3
$2 = 5
...
which indeed has the correct value.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug testsuite/29813] [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
2022-11-21 12:49 [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla vries at gcc dot gnu.org
@ 2022-11-21 12:56 ` vries at gcc dot gnu.org
2022-11-29 9:14 ` vries at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-21 12:56 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29813
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> I suppose the following happens. The DW_OP_GNU_entry_value needs to be
> evaluated, and gdb looks for a call site matching this pc:
> ...
> (gdb) up
> #1 0x0000000010000690 in main () at
> gdb/testsuite/gdb.base/vla-optimized-out.c:42
> 42 j = f1 (i);
> (gdb)
> ...
>
> There is a call site here:
> ...
> <2><f6>: Abbrev Number: 5 (DW_TAG_GNU_call_site)
> <f7> DW_AT_low_pc : 0x10000694
> <ff> DW_AT_abstract_origin: <0x110>
> ...
> which is not matched because it's 0x4 off.
That seems to be indeed the case:
...
(gdb) up
#1 0x00000000114d2d28 in throw_it (reason=RETURN_ERROR,
error=NO_ENTRY_VALUE_ERROR,
fmt=0x11597848 "DW_OP_entry_value resolving cannot find DW_TAG_call_site %s
in %s",
ap=0x7fffffffc6a0 "\244\006m\022")
at /suse/tdevries/gdb/src/gdbsupport/common-exceptions.cc:200
...
BTW, looking at the gcc sources, the bl;nop in call_value_nonlocal_aix<mode>
disappears in gcc-9-branch.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug testsuite/29813] [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
2022-11-21 12:49 [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla vries at gcc dot gnu.org
2022-11-21 12:56 ` [Bug testsuite/29813] " vries at gcc dot gnu.org
@ 2022-11-29 9:14 ` vries at gcc dot gnu.org
2022-11-29 9:51 ` vries at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-29 9:14 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29813
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> BTW, looking at the gcc sources, the bl;nop in call_value_nonlocal_aix<mode>
> disappears in gcc-9-branch.
Hmm, looking into that a bit more, I suspect that that was not the case, the
nop was just better hidden.
So, I've filed a gcc PR: PR107909 - "[powerpc64le, debug] Incorrect call site
location due to nop after call insn" (
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107909 ).
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug testsuite/29813] [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
2022-11-21 12:49 [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla vries at gcc dot gnu.org
2022-11-21 12:56 ` [Bug testsuite/29813] " vries at gcc dot gnu.org
2022-11-29 9:14 ` vries at gcc dot gnu.org
@ 2022-11-29 9:51 ` vries at gcc dot gnu.org
2022-11-29 13:33 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-29 9:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29813
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixing the .s code manually gets us:
...
$ 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>
...
and indeed there are no call site parameters in the call site, so now
"<optimized out>" is accurate.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug testsuite/29813] [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
2022-11-21 12:49 [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla vries at gcc dot gnu.org
` (2 preceding siblings ...)
2022-11-29 9:51 ` vries at gcc dot gnu.org
@ 2022-11-29 13:33 ` vries at gcc dot gnu.org
2022-11-29 21:47 ` cvs-commit at gcc dot gnu.org
2022-11-30 8:25 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-29 13:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29813
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2022-November/194326.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug testsuite/29813] [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
2022-11-21 12:49 [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla vries at gcc dot gnu.org
` (3 preceding siblings ...)
2022-11-29 13:33 ` vries at gcc dot gnu.org
@ 2022-11-29 21:47 ` cvs-commit at gcc dot gnu.org
2022-11-30 8:25 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-29 21:47 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29813
--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f3e033f32a0db3e81266a62b05f867b932a5995b
commit f3e033f32a0db3e81266a62b05f867b932a5995b
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Nov 29 22:47:31 2022 +0100
[gdb/testsuite] Fix gdb.base/vla-optimized-out.exp for ppc64le
On powerpc64le-linux, I run into:
...
(gdb) PASS: gdb.base/vla-optimized-out.exp: o1: printed optimized out vla
p sizeof (a)^M
$2 = <optimized out>^M
(gdb) FAIL: gdb.base/vla-optimized-out.exp: o1: \
printed size of optimized out vla
...
The problem happens as follows.
In order to find the size of the optimized out vla, gdb needs to evaluate:
...
<155> DW_AT_upper_bound : 13 byte block: f3 1 53 23 1 8 20 24 8 20 26 31 1c
\
(DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)); DW_OP_plus_uconst: 1;
DW_OP_const1u: 32; DW_OP_shl; DW_OP_const1u: 32; DW_OP_shra; DW_OP_lit1;
DW_OP_minus)
...
When trying to evaluate DW_OP_GNU_entry_value, it looks for a call site
matching the pc, but doesn't find it:
...
$ gdb -q -batch outputs/gdb.base/vla-optimized-out/vla-optimized-out-o1 \
-ex "break f1" -ex run -ex "set debug entry-values 1" -ex "print sizeof
(a)"
Breakpoint 1 at 0x1000067c: file vla-optimized-out.c, line 34.
Breakpoint 1, f1 (i=5) at vla-optimized-out.c:34
34 }
DW_OP_entry_value resolving cannot find DW_TAG_call_site 0x100006b0 in main
$1 = <optimized out>
....
The call site lookup fails because the call site label .LVL4:
...
bl f1 # 11 *call_value_nonlocal_aixdi [length = 8]
nop
.LVL4:
...
is not placed directly after the bl insn. This is gcc PR target/107909.
However, after manually fixing the .s file we have instead:
...
Cannot find matching parameter at DW_TAG_call_site 0x10000690 at main
$1 = <optimized out>
...
due to the fact that the call site has no call site parameters.
The call site does have a reference to the corresponding function f1, with
parameter i, for which we find location list entries:
...
0037 1000067c 10000680 (DW_OP_reg3 (r3))
004a 10000680 10000690 (DW_OP_GNU_entry_value: (DW_OP_reg3 (r3));
DW_OP_stack_value)
...
and we could use the fact that the current pc is in the 1000067c-10000680
range, and that that the range starts at the start of the function, to
deduce
that DW_OP_GNU_entry_value: (DW_OP_reg3 (r3)) == DW_OP_reg3 (r3).
But that's a non-trivial enhancement, filed as enhancement PR symtab/29836.
Fix this by allowing <optimized out> for target powerpc and the gcc
compiler.
Reviewed-By: Carl Love <cel@us.ibm.com>
Tested-By: Carl Love <cel@us.ibm.com>
PR testsuite/29813
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29813
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug testsuite/29813] [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
2022-11-21 12:49 [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla vries at gcc dot gnu.org
` (4 preceding siblings ...)
2022-11-29 21:47 ` cvs-commit at gcc dot gnu.org
@ 2022-11-30 8:25 ` vries at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2022-11-30 8:25 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29813
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |13.1
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by commit above.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-11-30 8:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 12:49 [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla vries at gcc dot gnu.org
2022-11-21 12:56 ` [Bug testsuite/29813] " vries at gcc dot gnu.org
2022-11-29 9:14 ` vries at gcc dot gnu.org
2022-11-29 9:51 ` vries at gcc dot gnu.org
2022-11-29 13:33 ` vries at gcc dot gnu.org
2022-11-29 21:47 ` cvs-commit at gcc dot gnu.org
2022-11-30 8:25 ` vries 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).