Bug 33447

Summary: Can't find class methods on clang compiled libraries
Product: gdb Reporter: Guinevere Larsen <guinevere>
Component: c++Assignee: Tom Tromey <tromey>
Status: NEW ---    
Severity: normal CC: aburgess, ssbssa, tromey
Priority: P2    
Version: HEAD   
Target Milestone: 18.1   
See Also: https://sourceware.org/bugzilla/show_bug.cgi?id=16994
https://sourceware.org/bugzilla/show_bug.cgi?id=16998
https://sourceware.org/bugzilla/show_bug.cgi?id=33557
Host: Target:
Build: Last reconfirmed:
Project(s) to access: ssh public key:

Description Guinevere Larsen 2025-09-18 10:40:17 UTC
When trying to run the test gdb.cp/cpexprs-debug-types.exp using clang, I run into 95 failures. It seems that searching for class methods is broken. These are the first few failures:

(gdb) PASS: gdb.cp/cpexprs-debug-types.exp: set listsize 1
print base1::a_function^M                                           
There is no field named a_function^M                                
(gdb) FAIL: gdb.cp/cpexprs-debug-types.exp: print base1::a_function 
print base1::base1(int)^M                                           
There is no field named base1^M                                     
(gdb) FAIL: gdb.cp/cpexprs-debug-types.exp: print base1::base1(int) 
print base1::base1(void)^M                                          
There is no field named base1^M                                     
(gdb) FAIL: gdb.cp/cpexprs-debug-types.exp: print base1::base1(void)
print base2::a_function^M                                           
There is no field named a_function^M                                
(gdb) FAIL: gdb.cp/cpexprs-debug-types.exp: print base2::a_function 

This started happening with commit: 

commit c879f4dc3e317cf6353a45a803ecf00d577a13d8                 
Author: Tom Tromey <tom@tromey.com>                                     
Date:   Tue Dec 31 13:30:18 2024 -0700                                  
                                                                        
    Convert lookup_symbol_via_quick_fns                                 
                                                                        
    This converts lookup_symbol_via_quick_fns to the callback approach, 
    merging the search loop and the call to expand_symtabs_matching.    
                                                                        
    Note that this changes lookup_symbol_via_quick_fns to use a         
    best_symbol_tracker.  Before this patch there was a discrepancy here
    between the two search functions.                                   
                                                                        
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994          
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998          
    Acked-By: Simon Marchi <simon.marchi@efficios.com>
Comment 1 Andrew Burgess 2025-10-20 15:58:01 UTC
Setting target milestone as this is a regression introduced since 17 branched.
Comment 2 Tom Tromey 2026-02-09 03:03:05 UTC
Entries for "a_function" have the wrong parent.

    [199] ((cooked_index_entry *) 0x7fffd8015f40)
    name:       a_function
    canonical:  a_function
    qualified:  a_function
    DWARF tag:  DW_TAG_subprogram
    flags:      0x0 []
    DIE offset: 0x3167
    CU index:   35
    parent:     ((cooked_index_entry *) 0)

I wonder if this is bug#32299.