Bug 29179

Summary: [cc-with-gdb-index] FAIL: gdb.ada/O2_float_param.exp: scenario=all: gdb_breakpoint: set breakpoint at increment
Product: gdb Reporter: Tom de Vries <vries>
Component: symtabAssignee: Tom Tromey <tromey>
Status: RESOLVED FIXED    
Severity: normal CC: tromey
Priority: P2    
Version: HEAD   
Target Milestone: 13.1   
Host: Target:
Build: Last reconfirmed:
Project(s) to access: ssh public key:
Bug Depends on:    
Bug Blocks: 29366    

Description Tom de Vries 2022-05-25 14:35:03 UTC
When running the testsuite with target board cc-with-gdb-index I see a lot of FAILs.

First one:
...
(gdb) break increment^M
Function "increment" not defined.^M
Make breakpoint pending on future shared library load? (y or [n]) n^M
(gdb) FAIL: gdb.ada/O2_float_param.exp: scenario=all: gdb_breakpoint: set breakpoint at increment
...

This passes with gdb 12 branch, so this is a regression.
Comment 1 Tom de Vries 2022-05-26 07:35:40 UTC
Bisects to commit 2cf349be0e3 ("Do not put linkage names into .gdb_index")
Comment 2 Tom de Vries 2022-07-08 11:39:00 UTC
Also observed this with cc-with-gdb-index, may well be related to the same commit:
...
FAIL: gdb.base/c-linkage-name.exp: print symada__cS before partial symtab expansion
...
Comment 3 Tom Tromey 2022-09-21 20:03:06 UTC
The index contains:

[774] callee.increment: 2 [global, function]

but the debug info says:

    <1ab9>   DW_AT_name        : (indirect string, offset: 0x22a4): callee__increment

Probably we need to do the ada_decode business from
commit 7ab96794115.
Comment 4 Tom Tromey 2022-09-21 20:24:02 UTC
Working on a patch.
Comment 6 Sourceware Commits 2022-10-17 16:11: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=5fea97943259a2bd997f92ffa66116b5c0d4eaab

commit 5fea97943259a2bd997f92ffa66116b5c0d4eaab
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Sep 22 08:43:47 2022 -0600

    Improve Ada support in .gdb_index
    
    The cooked index work changed how .gdb_index is constructed, and in
    the process broke .gdb_index support.  This is PR symtab/29179.
    
    This patch partially fixes the problem.  It arranges for Ada names to
    be encoded in the form expected by the index code.  In particular,
    linkage names for Ada are emitted, including the "main" name; names
    are Ada-encoded; and names are no longer case-folded, something that
    prevented operator names from round-tripping correctly.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29179
Comment 7 Sourceware Commits 2022-10-17 16:11:07 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

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

commit dd05fc7071a6517de13975fcddca861547351266
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Sep 22 13:10:55 2022 -0600

    Change .gdb_index de-duplication implementation
    
    While investigating PR symtab/29179, I found that one Ada test failed
    because, although a certain symbol was present in the index, with the
    new DWARF reader it pointed to a different CU than was chosen by
    earlier versions of gdb.
    
    This patch changes how symbol de-duplication is done, deferring the
    process until the entire symbol table has been constructed.  This way,
    it's possible to always choose the lower-numbered CU among duplicates,
    which is how gdb (implicitly) previously worked.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29179
Comment 8 Tom Tromey 2022-10-17 16:11:22 UTC
Fixed.