public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29220] GDB prints wrong value at -O2
Date: Sun, 05 Jun 2022 17:53:37 +0000	[thread overview]
Message-ID: <bug-29220-4717-mFQReeqEV4@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29220-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29220

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
readelf -wi shows 'a' defined as:

 <2><4c>: Abbrev Number: 3 (DW_TAG_variable)
    <4d>   DW_AT_name        : a
    <4f>   DW_AT_decl_file   : 1
    <50>   DW_AT_decl_line   : 8
    <51>   DW_AT_decl_column : 8
    <52>   DW_AT_type        : <0x5f>
    <56>   DW_AT_location    : 0x10 (location list)
    <5a>   DW_AT_GNU_locviews: 0xc

However the location lists say:

    00000010 v000000000000002 v000000000000003 views at 0000000c for:
             0000000000401020 0000000000401020 (DW_OP_lit0; DW_OP_stack_value)
    0000001d v000000000000003 v000000000000004 views at 0000000e for:
             0000000000401020 0000000000401020 (DW_OP_lit1; DW_OP_stack_value)


So on the one hand, I think gcc is setting the default here
and gdb is printing 0 correctly.

On the other hand, maybe locviews mean that gdb could sometimes show '1'.
I don't know though, and I can't find documentation on this attribute.

Anyway I tend to think this is at worst a missing feature from gdb.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

      parent reply	other threads:[~2022-06-05 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02  1:27 [Bug gdb/29220] New: " yangyibiao at outlook dot com
2022-06-02 16:46 ` [Bug gdb/29220] " tromey at sourceware dot org
2022-06-05 17:53 ` tromey at sourceware dot org [this message]

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-29220-4717-mFQReeqEV4@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).