>> That will do, although I think there might be a bug there :(. Let me >> double check. >> > > There is certainly a bug hit by Stan's test case, since it gets an error. > So yes there is a bug, I have not checked to see if it is Stan's bug, but here it goes: This is the test case that I am using: inline void second(){ int* a = 0; a[0] = 0; <-------- pc } void first(){ second(); } int main(){ first(); return 0; } So if I try to dwarf_getscopes at pc i get 0 scopes returned. The problem is in the pc_record function from dwarf_getscopes.c: > /* Now we are in a scope that contains the concrete inlined instance. > Search it for the inline function's abstract definition. > If we don't find it, return to search the containing scope. > If we do find it, the nonzero return value will bail us out > of the postorder traversal. */ > return __libdw_visit_scopes (depth, die, &origin_match, NULL, &a); > } The problem is that if the die passed to __libdw_visit_scopes has no children, __libdw_visit_scopes returns -1 which means that pc_record returns -1 and the search aborts, and no scopes are returned. The particular childless die in this case happens to be the one corresponding to main. I can fudge it by adding some variables to main and get the following scopes: scopes[0] DW_TAG_lexical_block name: scopes[1] DW_TAG_inlined_subroutine name: second scopes[2] DW_TAG_compile_unit name: /to/scratch/swagiaal/frysks/frysk/frysk-core/frysk/pkglibdir/funit-scopes.c I have attached two of possible patches: patch1 just check for children before the call, patch2 takes the responsibility away from pc_record and relies on the later call to pc_origin in dwarf_getscopes: [...] int result = __libdw_visit_scopes (0, &cu, &pc_match, &pc_record, &a); if (result == 0 && a.scopes != NULL) result = __libdw_visit_scopes (0, &cu, &origin_match, NULL, &a); [...] I personally like patch2 better. This way you only do two searches. Thoughts ? Thanks, Sami Wagiaalla