newp->startp = data->d_buf + newp->start;
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)
/* Maybe we already know that CU. */
struct Dwarf_CU fake = { .start = start, .end = 0 };
struct Dwarf_CU **found = eu_tfind (&fake, tree, findcu_cb);
+ struct Dwarf_CU *result = NULL;
if (found != NULL)
return *found;
- if (start < *next_offset)
- {
- __libdw_seterrno (DWARF_E_INVALID_DWARF);
- return NULL;
- }
+ rwlock_wrlock (dbg->dwarf_lock);
- /* No. Then read more CUs. */
- while (1)
- {
- struct Dwarf_CU *newp = __libdw_intern_next_unit (dbg, v4_debug_types);
- if (newp == NULL)
- return NULL;
-
- /* Is this the one we are looking for? */
- if (start < *next_offset || start == newp->start)
- return newp;
- }
- /* NOTREACHED */
+ if (start < *next_offset)
+ __libdw_seterrno (DWARF_E_INVALID_DWARF);
+ else
+ {
+ /* No. Then read more CUs. */
+ while (1)
+ {
+ struct Dwarf_CU *newp = __libdw_intern_next_unit (dbg,
+ v4_debug_types);
+ if (newp == NULL)
+ {
+ result = NULL;
+ break;
+ }
+
+ /* Is this the one we are looking for? */
+ if (start < *next_offset || start == newp->start)
+ {
+ result = newp;
+ break;
+ }
+ }
+ }
+
+ rwlock_unlock (dbg->dwarf_lock);
+ return result;
}
struct Dwarf_CU *