summaryrefslogtreecommitdiffstats
path: root/libdw
diff options
context:
space:
mode:
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog21
-rw-r--r--libdw/dwarf_begin_elf.c4
-rw-r--r--libdw/dwarf_decl_file.c2
-rw-r--r--libdw/dwarf_ranges.c5
-rw-r--r--libdw/libdw.h9
-rw-r--r--libdw/libdw_alloc.c5
-rw-r--r--libdw/libdw_visit_scopes.c6
7 files changed, 49 insertions, 3 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 59f33f9e..c75b0958 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,24 @@
+2020-05-08 Mark Wielaard <[email protected]>
+
+ * libdw_visit_scopes.c (walk_children): Don't recurse into imported
+ DW_TAG_compile_units.
+
+2020-05-08 Mark Wielaard <[email protected]>
+
+ * dwarf_decl_file.c (dwarf_decl_file): Use attr CU instead of DIE
+ CU to resolve file name.
+ * dwarf_ranges.c(dwarf_ranges): Document which CU we use when.
+ * libdw.h (dwarf_attr_integrate): Extend documentation.
+
+2020-04-25 Mark Wielaard <[email protected]>
+
+ * libdw_alloc.c (__libdw_alloc_tail): Call Dwarf oom_handler()
+ when malloc fails.
+
+2020-04-17 Mark Wielaard <[email protected]>
+
+ * dwarf_begin_elf.c (check_section): Handle .gnu.debuglto_ prefix.
+
2019-10-28 Aaron Merey <[email protected]>
* Makefile.am (libdw_so_LDLIBS): Add -ldl for libdebuginfod.so dlopen.
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 85343088..474ed138 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -137,6 +137,10 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp)
gnu_compressed = true;
break;
}
+ else if (scnlen > 14 /* .gnu.debuglto_ prefix. */
+ && strncmp (scnname, ".gnu.debuglto_", 14) == 0
+ && strcmp (&scnname[14], dwarf_scnnames[cnt]) == 0)
+ break;
}
if (cnt >= ndwarf_scnnames)
diff --git a/libdw/dwarf_decl_file.c b/libdw/dwarf_decl_file.c
index 5657132f..d4aa0a18 100644
--- a/libdw/dwarf_decl_file.c
+++ b/libdw/dwarf_decl_file.c
@@ -55,7 +55,7 @@ dwarf_decl_file (Dwarf_Die *die)
}
/* Get the array of source files for the CU. */
- struct Dwarf_CU *cu = die->cu;
+ struct Dwarf_CU *cu = attr_mem.cu;
if (cu->lines == NULL)
{
Dwarf_Lines *lines;
diff --git a/libdw/dwarf_ranges.c b/libdw/dwarf_ranges.c
index f67d8a5a..520f9ffe 100644
--- a/libdw/dwarf_ranges.c
+++ b/libdw/dwarf_ranges.c
@@ -506,6 +506,11 @@ dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep,
Dwarf_Attribute attr_mem;
Dwarf_Attribute *attr = INTUSE(dwarf_attr) (die, DW_AT_ranges,
&attr_mem);
+ /* Note that above we use dwarf_attr, not dwarf_attr_integrate.
+ The only case where the ranges can come from another DIE
+ attribute are the split CU case. In that case we also have a
+ different CU to check against. But that is already set up
+ above using __libdw_find_split_unit. */
if (attr == NULL
&& is_cudie (die)
&& die->cu->unit_type == DW_UT_split_compile)
diff --git a/libdw/libdw.h b/libdw/libdw.h
index e20961be..1a4e15a1 100644
--- a/libdw/libdw.h
+++ b/libdw/libdw.h
@@ -474,7 +474,14 @@ extern Dwarf_Attribute *dwarf_attr (Dwarf_Die *die, unsigned int search_name,
extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name);
/* These are the same as dwarf_attr and dwarf_hasattr, respectively,
- but they resolve an indirect attribute through DW_AT_abstract_origin. */
+ but they resolve an indirect attribute through
+ DW_AT_abstract_origin, DW_AT_specification or, if the DIE is a
+ top-level split CU, the skeleton DIE. Note that the attribute
+ might come from a DIE in a different CU (possibly from a different
+ Dwarf file). In that case all attribute information needs to be
+ resolved through the CU associated with the returned
+ Dwarf_Attribute. The dwarf_form functions already do this
+ automatically. */
extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die,
unsigned int search_name,
Dwarf_Attribute *result)
diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
index e0281a3d..b3e53343 100644
--- a/libdw/libdw_alloc.c
+++ b/libdw/libdw_alloc.c
@@ -87,6 +87,11 @@ __libdw_alloc_tail (Dwarf *dbg)
if (result == NULL)
{
result = malloc (dbg->mem_default_size);
+ if (result == NULL)
+ {
+ pthread_rwlock_unlock (&dbg->mem_rwl);
+ dbg->oom_handler();
+ }
result->size = dbg->mem_default_size
- offsetof (struct libdw_memblock, mem);
result->remaining = result->size;
diff --git a/libdw/libdw_visit_scopes.c b/libdw/libdw_visit_scopes.c
index eb892e10..7dfa5f6b 100644
--- a/libdw/libdw_visit_scopes.c
+++ b/libdw/libdw_visit_scopes.c
@@ -125,8 +125,12 @@ walk_children (struct walk_children_state *state)
Dwarf_Attribute *attr = INTUSE(dwarf_attr) (&state->child.die,
DW_AT_import,
&attr_mem);
+ /* Some gcc -flto versions imported other top-level compile units,
+ skip those. */
if (INTUSE(dwarf_formref_die) (attr, &state->child.die) != NULL
- && INTUSE(dwarf_child) (&state->child.die, &state->child.die) == 0)
+ && INTUSE(dwarf_tag) (&state->child.die) != DW_TAG_compile_unit
+ && (INTUSE(dwarf_child) (&state->child.die, &state->child.die)
+ == 0))
{
/* Checks the given DIE hasn't been imported yet
to prevent cycles. */