summaryrefslogtreecommitdiff
path: root/libdw/dwarf_formstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdw/dwarf_formstring.c')
-rw-r--r--libdw/dwarf_formstring.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/libdw/dwarf_formstring.c b/libdw/dwarf_formstring.c
index 790831ea..b7558efd 100644
--- a/libdw/dwarf_formstring.c
+++ b/libdw/dwarf_formstring.c
@@ -57,20 +57,20 @@
const char *
-dwarf_formstring (attrp)
+__libdw_formstring_rdlock (attrp)
Dwarf_Attribute *attrp;
{
/* Ignore earlier errors. */
if (attrp == NULL)
return NULL;
+ Dwarf *dbg = attrp->cu->dbg;
+
/* We found it. Now determine where the string is stored. */
if (attrp->form == DW_FORM_string)
/* A simple inlined string. */
return (const char *) attrp->valp;
- Dwarf *dbg = attrp->cu->dbg;
-
if (unlikely (attrp->form != DW_FORM_strp)
|| dbg->sectiondata[IDX_debug_str] == NULL)
{
@@ -91,4 +91,20 @@ dwarf_formstring (attrp)
return (const char *) dbg->sectiondata[IDX_debug_str]->d_buf + off;
}
+
+const char *
+dwarf_formstring (attrp)
+ Dwarf_Attribute *attrp;
+{
+ /* Ignore earlier errors. */
+ if (attrp == NULL)
+ return NULL;
+
+ Dwarf *dbg = attrp->cu->dbg;
+ rwlock_rdlock (dbg->lock);
+ const char *retval = __libdw_formstring_rdlock (attrp);
+ rwlock_unlock (dbg->lock);
+
+ return retval;
+}
INTDEF(dwarf_formstring)