Bug 32519

Summary: DWARF index doesn't have entries for anon-struct.exp
Product: gdb Reporter: Tom Tromey <tromey>
Component: symtabAssignee: Tom Tromey <tromey>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: HEAD   
Target Milestone: 18.1   
Host: Target:
Build: Last reconfirmed:
Project(s) to access: ssh public key:
Bug Depends on:    
Bug Blocks: 29366, 16998    

Description Tom Tromey 2025-01-05 18:43:28 UTC
With the patches for bug#16998, there are some fails:

FAIL: gdb.cp/anon-struct.exp: print type of t::t
FAIL: gdb.cp/anon-struct.exp: print type of X::t2::t2
FAIL: gdb.cp/anon-struct.exp: print type of t3::~t3

These symbols aren't added to the index.

This is hard or maybe impossible to observe right now,
because something like "print t::t" will first look
up "t", causing CU expansion.
Comment 1 Tom Tromey 2025-01-19 00:36:38 UTC
It's a bit of an oddity that fn_field doesn't just hold a pointer
to the symbol.
Comment 2 Sourceware Commits 2025-09-10 22:18:01 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e7605fe0c0f7fa14dff86373f2baae2d56da1d30

commit e7605fe0c0f7fa14dff86373f2baae2d56da1d30
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Jan 18 18:15:21 2025 -0700

    Entries from anon-struct.exp not in cooked index
    
    g++ will sometimes use a typedef to give a name to an otherwise
    anonymous type for linkage purposes.  gdb tries to handle this odd
    scenario, which is enforced by anon-struct.exp.
    
    It's difficult to detect this problem in the current tree, but the
    cooked index does not include an entry for these DIEs.
    
    This patch changes gdb to add these to the index.  This is needed by
    subsequent changes in this series.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32519
    Acked-By: Simon Marchi <simon.marchi@efficios.com>
Comment 3 Tom Tromey 2025-09-11 00:02:34 UTC
Fixed.