]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
addr2line: Iterate scopes for inline's parent function
authorJosh Stone <jistone@redhat.com>
Wed, 10 Dec 2014 19:06:52 +0000 (11:06 -0800)
committerJosh Stone <jistone@redhat.com>
Thu, 11 Dec 2014 18:47:00 +0000 (10:47 -0800)
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 <jistone@redhat.com>
src/ChangeLog
src/addr2line.c

index 1c3cf2fc64c46369ff2818d62c0eadb7b781d2a7..413a6bf6c9a33d58105963b18af01b4d759e5df1 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-10  Josh Stone  <jistone@redhat.com>
+
+       * addr2line.c (handle_address): Find the proper inline parents.
+
 2014-12-07  Mark Wielaard  <mjw@redhat.com>
 
        * readelf.c (print_debug_line_section): max_ops_per_instr cannot
index 50fc2b38c367e4fcf5c0f1309a79c372d9feb2f0..e8ffbc68749501e7be1fee9756e1f99398741245 100644 (file)
@@ -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;