public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30656] New: [gdb/symtab] optimized out static handled inconsistently
@ 2023-07-20  5:15 vries at gcc dot gnu.org
  2023-07-20  6:42 ` [Bug symtab/30656] " vries at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2023-07-20  5:15 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30656
           Summary: [gdb/symtab] optimized out static handled
                    inconsistently
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I wrote a dwarf assembly test-case simulating an optimized-out static variable:
...
  Compilation Unit @ offset 0xb1:
   Length:        0x1e (32-bit)
   Version:       4
   Abbrev Offset: 0x67
   Pointer Size:  8
 <0><bc>: Abbrev Number: 2 (DW_TAG_compile_unit)
    <bd>   DW_AT_language    : 2        (non-ANSI C)
 <1><be>: Abbrev Number: 3 (DW_TAG_base_type)
    <bf>   DW_AT_byte_size   : 8
    <c0>   DW_AT_encoding    : 5        (signed)
    <c1>   DW_AT_name        : integer
 <1><c9>: Abbrev Number: 4 (DW_TAG_variable)
    <ca>   DW_AT_name        : var
    <ce>   DW_AT_type        : <0xbe>
 <1><d2>: Abbrev Number: 0
...

I get different behaviour for when the symtab is not expanded:
...
$ gdb -q -batch ./static-optimized-out -ex "print var"
No symbol "var" in current context.
...
and when it is expanded:
...
$ gdb -q -batch -readnow ./static-optimized-out -ex "print var"
$1 = <optimized out>
...

I can reproduce this as far back as gdb-8.3-branch (though there's a crash with
gdb-10-branch).

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-07-21 14:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20  5:15 [Bug symtab/30656] New: [gdb/symtab] optimized out static handled inconsistently vries at gcc dot gnu.org
2023-07-20  6:42 ` [Bug symtab/30656] " vries at gcc dot gnu.org
2023-07-20  6:48 ` vries at gcc dot gnu.org
2023-07-20  7:35 ` vries at gcc dot gnu.org
2023-07-20 14:43 ` vries at gcc dot gnu.org
2023-07-21  6:25 ` cvs-commit at gcc dot gnu.org
2023-07-21  6:26 ` vries at gcc dot gnu.org
2023-07-21  6:51 ` vries at gcc dot gnu.org
2023-07-21 14:14 ` vries at gcc dot gnu.org
2023-07-21 14:16 ` 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).