public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug testsuite/29813] New: [gdb/testsuite, powerpc64le] FAIL: gdb.base/vla-optimized-out.exp: o1: printed size of optimized out vla
Date: Mon, 21 Nov 2022 12:49:19 +0000	[thread overview]
Message-ID: <bug-29813-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2022-11-21 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 12:49 vries at gcc dot gnu.org [this message]
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

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