]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
addr2line: Honor -s and -A for file names of inline call sites.
authorRoland McGrath <roland@redhat.com>
Mon, 20 Apr 2009 08:20:44 +0000 (01:20 -0700)
committerRoland McGrath <roland@redhat.com>
Mon, 20 Apr 2009 08:20:44 +0000 (01:20 -0700)
src/ChangeLog
src/addr2line.c

index 20f5d9872b903bc71fe70dde9ed1c5ddfa2e2007..a2e209a19ee26ced685d6ba3f41521d6f535630b 100644 (file)
@@ -1,5 +1,8 @@
 2009-04-20  Roland McGrath  <roland@redhat.com>
 
+       * addr2line.c (print_dwarf_function): Honor -s and -A for file names
+       of inline call sites.
+
        * addr2line.c (just_section): New variable.
        (adjust_to_section): New function, broken out of ...
        (handle_address): ... here.
index ccc10e8f47883a6ee699ede76e49e41f571f9b95..99264b01d16880c817af0db800875ffb90297d29 100644 (file)
@@ -284,15 +284,35 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr)
                                                   DW_AT_call_column,
                                                   &attr_mem), &val) == 0)
                    colno = val;
-                 if (lineno == 0)
+
+                 const char *comp_dir = "";
+                 const char *comp_dir_sep = "";
+
+                 if (file == NULL)
+                   file = "???";
+                 else if (only_basenames)
+                   file = basename (file);
+                 else if (use_comp_dir && file[0] != '/')
                    {
-                     if (file != NULL)
-                       printf (" from %s", file);
+                     const char *const *dirs;
+                     size_t ndirs;
+                     if (dwarf_getsrcdirs (files, &dirs, &ndirs) == 0
+                         && dirs[0] != NULL)
+                       {
+                         comp_dir = dirs[0];
+                         comp_dir_sep = "/";
+                       }
                    }
+
+                 if (lineno == 0)
+                   printf (" from %s%s%s",
+                           comp_dir, comp_dir_sep, file);
                  else if (colno == 0)
-                   printf (" at %s:%u", file, lineno);
+                   printf (" at %s%s%s:%u",
+                           comp_dir, comp_dir_sep, file, lineno);
                  else
-                   printf (" at %s:%u:%u", file, lineno, colno);
+                   printf (" at %s%s%s:%u:%u",
+                           comp_dir, comp_dir_sep, file, lineno, colno);
                }
            }
          printf (" in ");