aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-09-06 12:24:06 -0600
committerTom Tromey <tromey@adacore.com>2025-03-06 14:17:17 -0700
commit5fce64293afc4fdd216e8bfe5b7abd0fbae71f16 (patch)
treed7875329e888978a1a30a36be70eb75391653ae9
parent7eccd2e407890a554ffc64d015ba82b7fdf941c4 (diff)
downloadbinutils-5fce64293afc4fdd216e8bfe5b7abd0fbae71f16.zip
binutils-5fce64293afc4fdd216e8bfe5b7abd0fbae71f16.tar.gz
binutils-5fce64293afc4fdd216e8bfe5b7abd0fbae71f16.tar.bz2
Use dwarf2_full_name when computing type names
This changes a few spots in the DWARF reader to use dwarf2_full_name when computing the name of a type. This gives the correct name when a type is nested in a namespace. This oddity probably wasn't noticed before because some of the types in question are either normally anonymous in C++ (e.g, array type) or do not appear in a namespace (base type).
-rw-r--r--gdb/dwarf2/read.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index dda925e..0859262 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -11625,7 +11625,8 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
{
if (cu->lang () == language_cplus
|| cu->lang () == language_d
- || cu->lang () == language_rust)
+ || cu->lang () == language_rust
+ || cu->lang () == language_ada)
{
const char *full_name = dwarf2_full_name (name, die, cu);
@@ -12773,7 +12774,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
"than the total size of elements"));
}
- name = dwarf2_name (die, cu);
+ name = dwarf2_full_name (nullptr, die, cu);
if (name)
type->set_name (name);
@@ -14228,7 +14229,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_byte_size, cu);
if (attr != nullptr)
bits = attr->constant_value (0) * TARGET_CHAR_BIT;
- name = dwarf2_name (die, cu);
+ name = dwarf2_full_name (nullptr, die, cu);
if (!name)
complaint (_("DW_AT_name missing from DW_TAG_base_type"));
@@ -14788,7 +14789,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
if (attr == NULL && cu->lang () != language_ada)
range_type->bounds ()->high.set_undefined ();
- name = dwarf2_name (die, cu);
+ name = dwarf2_full_name (nullptr, die, cu);
if (name)
range_type->set_name (name);