]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix latent bug in Ada import symbol handling
authorTom Tromey <tom@tromey.com>
Thu, 19 Dec 2024 01:49:45 +0000 (18:49 -0700)
committerTom Tromey <tom@tromey.com>
Sun, 5 Jan 2025 18:58:49 +0000 (11:58 -0700)
commit64800e8954245cd32c797fb2e207a66793193bf3
treeb3e8232341ffb9455d52568a6f191c76310ae14e
parent05248f5ff0b92ada207dea4fab8f20df35746564
Fix latent bug in Ada import symbol handling

The code in dwarf2/read.c:new_symbol that handles Ada 'import' symbols
has a bug.  It uses the current scope, which by default this is the
file scope -- even for a global symbol like:

 <1><1186>: Abbrev Number: 4 (DW_TAG_variable)
    <1187>   DW_AT_name        : (indirect string, offset: 0x1ad2): pkg__imported_var_ada
...
    <1196>   DW_AT_external    : 1

This disagrees with the scope computed by the DWARF indexer.

Now, IMO new_symbol and its various weirdness really has to go.  And,
ideally, this information would come from the indexer rather than
perhaps being erroneously recomputed.  But meanwhile, this patch fixes
the issue at hand.

This came up while working on another change that exposes the bug.

Reviewed-By: Tom de Vries <tdevries@suse.de>
gdb/dwarf2/read.c