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

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).