summaryrefslogtreecommitdiffstats
path: root/libdw
diff options
context:
space:
mode:
Diffstat (limited to 'libdw')
-rw-r--r--libdw/dwarf_entry_breakpoints.c24
-rw-r--r--libdw/dwarf_getscopevar.c9
-rw-r--r--libdw/libdw_visit_scopes.c6
3 files changed, 33 insertions, 6 deletions
diff --git a/libdw/dwarf_entry_breakpoints.c b/libdw/dwarf_entry_breakpoints.c
index 578464f3..f6baaf6f 100644
--- a/libdw/dwarf_entry_breakpoints.c
+++ b/libdw/dwarf_entry_breakpoints.c
@@ -60,11 +60,19 @@ dwarf_entry_breakpoints (die, bkpts)
Dwarf_Die *die;
Dwarf_Addr **bkpts;
{
+#ifdef __clang__
+ __block int nbkpts = 0;
+#else
int nbkpts = 0;
+#endif
*bkpts = NULL;
/* Add one breakpoint location to the result vector. */
+#ifdef __clang__
+ int (^add_bkpt) (Dwarf_Addr) = ^int (Dwarf_Addr pc)
+#else
inline int add_bkpt (Dwarf_Addr pc)
+#endif
{
Dwarf_Addr *newlist = realloc (*bkpts, ++nbkpts * sizeof newlist[0]);
if (newlist == NULL)
@@ -77,14 +85,18 @@ dwarf_entry_breakpoints (die, bkpts)
newlist[nbkpts - 1] = pc;
*bkpts = newlist;
return nbkpts;
- }
+ };
/* Fallback result, break at the entrypc/lowpc value. */
+#ifdef __clang__
+ int (^entrypc_bkpt) (void) = ^int (void)
+#else
inline int entrypc_bkpt (void)
+#endif
{
Dwarf_Addr pc;
return INTUSE(dwarf_entrypc) (die, &pc) < 0 ? -1 : add_bkpt (pc);
- }
+ };
/* Fetch the CU's line records to look for this DIE's addresses. */
Dwarf_Die cudie = CUDIE (die->cu);
@@ -102,8 +114,14 @@ dwarf_entry_breakpoints (die, bkpts)
/* Search a contiguous PC range for prologue-end markers.
If DWARF, look for proper markers.
Failing that, if ADHOC, look for the ad hoc convention. */
+#ifdef __clang__
+ int (^search_range) (Dwarf_Addr, Dwarf_Addr,
+ bool, bool) = ^int (Dwarf_Addr low, Dwarf_Addr high,
+ bool dwarf, bool adhoc)
+#else
inline int search_range (Dwarf_Addr low, Dwarf_Addr high,
bool dwarf, bool adhoc)
+#endif
{
size_t l = 0, u = nlines;
while (l < u)
@@ -136,7 +154,7 @@ dwarf_entry_breakpoints (die, bkpts)
}
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return -1;
- }
+ };
/* Search each contiguous address range for DWARF prologue_end markers. */
diff --git a/libdw/dwarf_getscopevar.c b/libdw/dwarf_getscopevar.c
index 4e5b429e..5288fcf4 100644
--- a/libdw/dwarf_getscopevar.c
+++ b/libdw/dwarf_getscopevar.c
@@ -91,9 +91,14 @@ dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
{
/* Match against the given file name. */
size_t match_file_len = match_file == NULL ? 0 : strlen (match_file);
- bool lastfile_matches = false;
const char *lastfile = NULL;
+#ifdef __clang__
+ __block bool lastfile_matches = false;
+ bool (^file_matches) (Dwarf_Files *, size_t) = ^bool (Dwarf_Files *files, size_t idx)
+#else
+ bool lastfile_matches = false;
inline bool file_matches (Dwarf_Files *files, size_t idx)
+#endif
{
if (idx >= files->nfiles)
return false;
@@ -108,7 +113,7 @@ dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
|| file[len - match_file_len - 1] == '/'));
}
return lastfile_matches;
- }
+ };
/* Start with the innermost scope and move out. */
for (int out = 0; out < nscopes; ++out)
diff --git a/libdw/libdw_visit_scopes.c b/libdw/libdw_visit_scopes.c
index 9c7c3789..fd7f402f 100644
--- a/libdw/libdw_visit_scopes.c
+++ b/libdw/libdw_visit_scopes.c
@@ -109,11 +109,15 @@ __libdw_visit_scopes (depth, root, previsit, postvisit, arg)
if (INTUSE(dwarf_child) (&root->die, &child.die) != 0)
return -1;
+#ifdef __clang__
+ int (^recurse) (void) = ^int(void)
+#else
inline int recurse (void)
+#endif
{
return __libdw_visit_scopes (depth + 1, &child,
previsit, postvisit, arg);
- }
+ };
do
{