From: Josh Stone Date: Wed, 10 Dec 2014 19:06:52 +0000 (-0800) Subject: addr2line: Iterate scopes for inline's parent function X-Git-Tag: elfutils-0.161~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aecdf2670c027adde8ff800397a48b1b2403dd89;p=thirdparty%2Felfutils.git addr2line: Iterate scopes for inline's parent function The function which contains an inline might not be the immediate next die scope. For instance, there may be a lexical scope in between. Instead, iterate the remaining scopes until an appropriate tag is found. Signed-off-by: Josh Stone --- diff --git a/src/ChangeLog b/src/ChangeLog index 1c3cf2fc6..413a6bf6c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-12-10 Josh Stone + + * addr2line.c (handle_address): Find the proper inline parents. + 2014-12-07 Mark Wielaard * readelf.c (print_debug_line_section): max_ops_per_instr cannot diff --git a/src/addr2line.c b/src/addr2line.c index 50fc2b38c..e8ffbc687 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -672,7 +672,23 @@ handle_address (const char *string, Dwfl *dwfl) continue; if (show_functions) - print_diesym (&scopes[i + 1]); + { + /* Search for the parent inline or function. It + might not be directly above this inline -- e.g. + there could be a lexical_block in between. */ + for (int j = i + 1; j < nscopes; j++) + { + Dwarf_Die *parent = &scopes[j]; + int tag = dwarf_tag (parent); + if (tag == DW_TAG_inlined_subroutine + || tag == DW_TAG_entry_point + || tag == DW_TAG_subprogram) + { + print_diesym (parent); + break; + } + } + } src = NULL; lineno = 0;