diff options
Diffstat (limited to 'libdw/dwarf_tag.c')
-rw-r--r-- | libdw/dwarf_tag.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/libdw/dwarf_tag.c b/libdw/dwarf_tag.c index 15183d2d..a721f3d1 100644 --- a/libdw/dwarf_tag.c +++ b/libdw/dwarf_tag.c @@ -55,9 +55,8 @@ #include "libdwP.h" -Dwarf_Abbrev * -internal_function -__libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) +static Dwarf_Abbrev * +findabbrev (struct Dwarf_CU *cu, unsigned int code, int wrlocked) { Dwarf_Abbrev *abb; @@ -70,8 +69,10 @@ __libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) /* Find the next entry. It gets automatically added to the hash table. */ - abb = __libdw_getabbrev (cu->dbg, cu, cu->last_abbrev_offset, &length, - NULL); + abb = (wrlocked + ? __libdw_getabbrev_wrlock + : __libdw_getabbrev) (cu->dbg, cu, cu->last_abbrev_offset, + &length, NULL); if (abb == NULL || abb == DWARF_END_ABBREV) { /* Make sure we do not try to search for it again. */ @@ -89,9 +90,22 @@ __libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) return abb; } +Dwarf_Abbrev * +internal_function +__libdw_findabbrev_wrlock (struct Dwarf_CU *cu, unsigned int code) +{ + return findabbrev (cu, code, 1); +} + +Dwarf_Abbrev * +internal_function +__libdw_findabbrev (struct Dwarf_CU *cu, unsigned int code) +{ + return findabbrev (cu, code, 0); +} int -dwarf_tag (die) +__libdw_tag_rdlock (die) Dwarf_Die *die; { /* Do we already know the abbreviation? */ @@ -114,4 +128,16 @@ dwarf_tag (die) return die->abbrev->tag; } + + +int +dwarf_tag (die) + Dwarf_Die *die; +{ + rwlock_rdlock (die->cu->dbg->lock); + int retval = __libdw_tag_rdlock (die); + rwlock_unlock (die->cu->dbg->lock); + + return retval; +} INTDEF(dwarf_tag) |