addr2line: Honor -s and -A for file names of inline call sites.
diff --git a/src/ChangeLog b/src/ChangeLog
index 20f5d98..a2e209a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/addr2line.c b/src/addr2line.c
index ccc10e8..99264b0 100644
--- a/src/addr2line.c
+++ b/src/addr2line.c
@@ -284,15 +284,35 @@
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 ");