* libdw/dwarf_end.c (cu_free): Free split_lock.
* libdw/dwarf_formref_die.c (dwarf_formref_die): Add locking
around call to __libdw_intern_next_unit.
* libdw/libdwP.h (struct Dwarf_CU): Add split_lock.
* libdw/libdw_find_split_unit.c (__libdw_find_split_unit):
Add locking.
* libdw/libdw_findcu.c (__libdw_intern_next_unit): Init
split_lock.
Signed-off-by: Heather S. McIntyre <hsm2@rice.edu>
Signed-off-by: Aaron Merey <amerey@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
{
Dwarf_Abbrev_Hash_free (&p->abbrev_hash);
rwlock_fini (p->abbrev_lock);
+ rwlock_fini (p->split_lock);
/* Free split dwarf one way (from skeleton to split). */
if (p->unit_type == DW_UT_skeleton
bool scan_debug_types = false;
do
{
+ rwlock_wrlock(attr->cu->dbg->dwarf_lock);
cu = __libdw_intern_next_unit (attr->cu->dbg, scan_debug_types);
+ rwlock_unlock(attr->cu->dbg->dwarf_lock);
+
if (cu == NULL)
{
if (scan_debug_types == false)
refers to this Dwarf_CU. */
rwlock_define(, abbrev_lock);
+ /* Synchronize access to the split member of this Dwarf_CU. */
+ rwlock_define(, split_lock);
+
/* Memory boundaries of this CU. */
void *startp;
void *endp;
internal_function
__libdw_find_split_unit (Dwarf_CU *cu)
{
+ /* Set result before releasing the lock. */
+ Dwarf_CU *result;
+
+ rwlock_wrlock(cu->split_lock);
+
/* Only try once. */
if (cu->split != (Dwarf_CU *) -1)
- return cu->split;
+ {
+ result = cu->split;
+ rwlock_unlock(cu->split_lock);
+ return result;
+ }
/* We need a skeleton unit with a comp_dir and [GNU_]dwo_name attributes.
The split unit will be the first in the dwo file and should have the
if (cu->split == (Dwarf_CU *) -1)
cu->split = NULL;
- return cu->split;
+ result = cu->split;
+ rwlock_unlock(cu->split_lock);
+ return result;
}
newp->endp = data->d_buf + newp->end;
eu_search_tree_init (&newp->locs_tree);
rwlock_init (newp->abbrev_lock);
+ rwlock_init (newp->split_lock);
/* v4 debug type units have version == 4 and unit_type == DW_UT_type. */
if (debug_types)