public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug rust/32471] New: can't call is_some method
@ 2024-12-17 18:26 tromey at sourceware dot org
  0 siblings, 0 replies; only message in thread
From: tromey at sourceware dot org @ 2024-12-17 18:26 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 32471
           Summary: can't call is_some method
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: rust
          Assignee: unassigned at sourceware dot org
          Reporter: tromey at sourceware dot org
  Target Milestone: ---

This comes from:

https://github.com/rust-lang/rust/issues/33014#issuecomment-2390543267

Consider this program:

#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_assignments)]

fn empty () { }

fn main() {
    let a : Option<u32> = Some(23);
    let is = a.is_some();

    empty();
}


Compiling this with -g shows that the DWARF does have is_some:

 <3><438>: Abbrev Number: 22 (DW_TAG_structure_type)
    <439>   DW_AT_name        : (indirect string, offset: 0x31e): Option<u32>
[...]
 <4><499>: Abbrev Number: 24 (DW_TAG_subprogram)
    <49a>   DW_AT_linkage_name: (indirect string, offset: 0x2c0):
_ZN4core6option15Option$LT$T$GT$7is_some17h6eebf1fea383378fE
    <49e>   DW_AT_name        : (indirect string, offset: 0x2fd): is_some<u32>


However:

(gdb) p a.is_some()
Could not find function named 'core::option::Option<u32>::is_some'

Trying the name with parameters also fails:

(gdb) p a.is_some<u32>()
Attempting to access named field is_some of tuple variant
core::option::Option<u32>::Some, which has only anonymous fields


Perhaps relatedly, "p a.is_<TAB>" just beeps and does not complete.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-17 18:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-17 18:26 [Bug rust/32471] New: can't call is_some method tromey at sourceware dot 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).