Bug 32510 - Inconsistent treatment of template parameters in symbol lookup
Summary: Inconsistent treatment of template parameters in symbol lookup
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 17.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks: 16998
  Show dependency treegraph
 
Reported: 2025-01-01 20:40 UTC by Tom Tromey
Modified: 2025-03-06 14:49 UTC (History)
0 users

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 Tom Tromey 2025-01-01 20:40:59 UTC
If you hack a "clean_restart" call into gdb.cp/paramless.exp, just
before the "break outer::fn" test, this will cause a failure.

I suspect this is caused by the inconsistent treatment of template
parameters when matching: cp_fq_symbol_name_matches passes
false to strncmp_iw_with_mode but cp_symbol_name_matches
passes true.

If you force CU expansion here with "break main" first, it
will pass again.
Comment 1 Sourceware Commits 2025-03-05 17:13:10 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

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

commit 6a739b5551261f53774c2773a912668c14d991f9
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Jan 1 14:34:10 2025 -0700

    Inconsistent treatment of template parameters in DWARF reader
    
    I noticed that if you hack some clean_restart calls into
    paramless.exp, the test will fail.  That is, the test currently relies
    on the desired CUs already being expanded when trying to set a
    breakpoint -- which is clearly a bug, the CU expansion state should
    not affect "break".
    
    I tracked this down to incorrect construction of a lookup_name_info in
    cooked_index_functions::expand_symtabs_matching.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32510
    Approved-By: Simon Marchi <simon.marchi@efficios.com>
Comment 2 Tom Tromey 2025-03-06 14:49:05 UTC
Fixed.