]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/symtab] Skip local variables in cooked index
authorTom de Vries <tdevries@suse.de>
Sat, 19 Oct 2024 05:57:21 +0000 (07:57 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 19 Oct 2024 05:57:21 +0000 (07:57 +0200)
commitcd05f8d44dd3a11b753a11ef5f8e36dcf4a379f5
tree8c0d4e9f9d2b65279e8b1b5ab86432446abce52a
parentf4b00218b542099c69b89bb8b77101607fd64ba0
[gdb/symtab] Skip local variables in cooked index

Consider test-case gdb.dwarf2/local-var.exp.  The corresponding source
contains a function with a local variable:
...
program test
  logical :: local_var
  local_var = .TRUE.
end
...

Currently, the local variable shows up in the cooked index:
...
    [2] ((cooked_index_entry *) 0xfffec40063b0)
    name:       local_var
    canonical:  local_var
    qualified:  local_var
    DWARF tag:  DW_TAG_variable
    flags:      0x2 [IS_STATIC]
    DIE offset: 0xa3
    parent:     ((cooked_index_entry *) 0xfffec4006380) [test]
...
making the cooked index larger than necessary.

Fix this by skipping it in cooked_indexer::index_dies.

Tested on aarch64-linux.

PR symtab/32276
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32276
gdb/dwarf2/read.c
gdb/testsuite/gdb.dwarf2/local-var.exp [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/local-var.f90 [new file with mode: 0644]