Bug 33447 - Can't find class methods on clang compiled libraries
Summary: Can't find class methods on clang compiled libraries
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 18.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-18 10:40 UTC by Guinevere Larsen
Modified: 2026-02-09 03:03 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.