public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb] Fix abstract_to_concrete type
@ 2019-06-18 17:00 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-06-18 17:00 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3360b6e7963e3c579e50078e78d226ea63e2960f
commit 3360b6e7963e3c579e50078e78d226ea63e2960f
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Jun 18 18:59:51 2019 +0200
[gdb] Fix abstract_to_concrete type
The test-case varval.exp fails here:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...
with boards readnow/cc-with-gdb-index/cc-with-debug-names, as well as if gdb
is build with -fsanitize=address -lasan.
The problem is that the abstract_to_concrete map in which we track the
association of abstract to concrete DIEs (for DW_OP_GNU_variable_value
support) has type std::unordered_map<die_info_ptr, std::vector<die_info_ptr>>,
and the die_info_ptrs that we register in the map may be invalid by the time
that we start to lookup DIEs in the map.
Fix this by using the sect_offset instead to identify the DIEs in the map.
Build and tested on x86_64-linux.
gdb/ChangeLog:
2019-06-18 Tom de Vries <tdevries@suse.de>
PR gdb/24515
* dwarf2read.h (abstract_to_concrete): Change type from
std::unordered_map<die_info_ptr, std::vector<die_info_ptr>> to
std::unordered_map<sect_offset, std::vector<sect_offset>>.
* dwarf2read.c (read_variable): Update.
(dwarf2_fetch_die_loc_sect_off): Update.
Diff:
---
gdb/ChangeLog | 9 +++++++++
gdb/dwarf2read.c | 13 +++++++++----
gdb/dwarf2read.h | 2 +-
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 22a473a..83f47b2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2019-06-18 Tom de Vries <tdevries@suse.de>
+
+ PR gdb/24515
+ * dwarf2read.h (abstract_to_concrete): Change type from
+ std::unordered_map<die_info_ptr, std::vector<die_info_ptr>> to
+ std::unordered_map<sect_offset, std::vector<sect_offset>>.
+ * dwarf2read.c (read_variable): Update.
+ (dwarf2_fetch_die_loc_sect_off): Update.
+
2019-06-17 Tom de Vries <tdevries@suse.de>
PR gdb/24617
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a51ae49..9cf513b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -14288,7 +14288,7 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu)
struct die_info *origin_die
= follow_die_ref (die, abstract_origin, &origin_cu);
dwarf2_per_objfile *dpo = cu->per_cu->dwarf2_per_objfile;
- dpo->abstract_to_concrete[origin_die].push_back (die);
+ dpo->abstract_to_concrete[origin_die->sect_off].push_back (die->sect_off);
}
}
@@ -23256,14 +23256,19 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
attr = dwarf2_attr (die, DW_AT_location, cu);
if (!attr && resolve_abstract_p
- && (dwarf2_per_objfile->abstract_to_concrete.find (die)
+ && (dwarf2_per_objfile->abstract_to_concrete.find (die->sect_off)
!= dwarf2_per_objfile->abstract_to_concrete.end ()))
{
CORE_ADDR pc = (*get_frame_pc) (baton);
- for (const auto &cand : dwarf2_per_objfile->abstract_to_concrete[die])
+ for (const auto &cand_off
+ : dwarf2_per_objfile->abstract_to_concrete[die->sect_off])
{
- if (!cand->parent
+ struct dwarf2_cu *cand_cu = cu;
+ struct die_info *cand
+ = follow_die_offset (cand_off, per_cu->is_dwz, &cand_cu);
+ if (!cand
+ || !cand->parent
|| cand->parent->tag != DW_TAG_subprogram)
continue;
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index e865895..776860e 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -256,7 +256,7 @@ public:
/* Mapping from abstract origin DIE to concrete DIEs that reference it as
DW_AT_abstract_origin. */
- std::unordered_map<die_info_ptr, std::vector<die_info_ptr>>
+ std::unordered_map<sect_offset, std::vector<sect_offset>>
abstract_to_concrete;
};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-18 17:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 17:00 [binutils-gdb] [gdb] Fix abstract_to_concrete type Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).