summaryrefslogtreecommitdiffstats
path: root/src/addr2line.c
diff options
context:
space:
mode:
authorJosh Stone <[email protected]>2014-12-10 11:06:52 -0800
committerJosh Stone <[email protected]>2014-12-11 10:47:00 -0800
commitaecdf2670c027adde8ff800397a48b1b2403dd89 (patch)
tree18cd3f15ac1fdc8ad9083842770055d70b34da56 /src/addr2line.c
parentf0c5ef85bbea093af42c2b95a1f349ebef63de0d (diff)
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 <[email protected]>
Diffstat (limited to 'src/addr2line.c')
-rw-r--r--src/addr2line.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/addr2line.c b/src/addr2line.c
index 50fc2b38..e8ffbc68 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;