summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2010-08-24 15:38:42 -0700
committerRoland McGrath <roland@redhat.com>2010-08-24 15:39:12 -0700
commitde44f133b20ecdd3e8dab9743fe6dce5c69ab85d (patch)
tree0f43372942d06abe1f10896347fe4587cef095e9
parentf85fe04d960670e61a8942a7077e186faec80ad1 (diff)
downloadelfutils-de44f133b20ecdd3e8dab9743fe6dce5c69ab85d.tar.gz
Add dwfl_dwarf_line, addr2line -F to print out more line info bits.
-rw-r--r--NEWS6
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/libdw.map5
-rw-r--r--libdwfl/ChangeLog5
-rw-r--r--libdwfl/Makefile.am2
-rw-r--r--libdwfl/libdwfl.h3
-rw-r--r--src/addr2line.c42
7 files changed, 64 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 975e2948..599ea321 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Version 0.149:
+
+libdwfl: New function dwfl_dwarf_line.
+
+addr2line: New flag -F/--flags to print DWARF more line information details.
+
Version 0.148:
libdw: Accept DWARF 4 format: new functions dwarf_next_unit, dwarf_offdie_types.
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index d0b54f3c..dc1a7f38 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-24 Roland McGrath <roland@redhat.com>
+
+ * libdw.map (ELFUTILS_0.149): New set. Add dwfl_dwarf_line.
+
2010-07-27 Roland McGrath <roland@redhat.com>
* dwarf_formref_die.c: Fix sig8 hash insertion.
diff --git a/libdw/libdw.map b/libdw/libdw.map
index 8e93dff8..6d6b365f 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -247,3 +247,8 @@ ELFUTILS_0.148 {
dwarf_next_unit;
dwarf_offdie_types;
} ELFUTILS_0.146;
+
+ELFUTILS_0.149 {
+ global:
+ dwfl_dwarf_line;
+} ELFUTILS_0.148;
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index eb8aa8ac..cc6dfb5b 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-24 Roland McGrath <roland@redhat.com>
+
+ * dwfl_dwarf_line.c: New file.
+ * Makefile.am (libdwfl_a_SOURCES): Add it.
+
2010-08-18 Roland McGrath <roland@redhat.com>
* link_map.c (report_r_debug): Use found name if we have no name,
diff --git a/libdwfl/Makefile.am b/libdwfl/Makefile.am
index 8ec1f4fa..65b38965 100644
--- a/libdwfl/Makefile.am
+++ b/libdwfl/Makefile.am
@@ -53,7 +53,7 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \
cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \
dwfl_module_addrdie.c dwfl_addrdie.c \
lines.c dwfl_lineinfo.c dwfl_line_comp_dir.c \
- dwfl_linemodule.c dwfl_linecu.c \
+ dwfl_linemodule.c dwfl_linecu.c dwfl_dwarf_line.c \
dwfl_getsrclines.c dwfl_onesrcline.c \
dwfl_module_getsrc.c dwfl_getsrc.c \
dwfl_module_getsrc_file.c \
diff --git a/libdwfl/libdwfl.h b/libdwfl/libdwfl.h
index 51e98187..4ea2796c 100644
--- a/libdwfl/libdwfl.h
+++ b/libdwfl/libdwfl.h
@@ -527,6 +527,9 @@ extern const char *dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr,
int *linep, int *colp,
Dwarf_Word *mtime, Dwarf_Word *length);
+ /* Return the equivalent Dwarf_Line and the bias to apply to its address. */
+extern Dwarf_Line *dwfl_dwarf_line (Dwfl_Line *line, Dwarf_Addr *bias);
+
/* Return the compilation directory (AT_comp_dir) from this line's CU. */
extern const char *dwfl_line_comp_dir (Dwfl_Line *line);
diff --git a/src/addr2line.c b/src/addr2line.c
index 48f017bb..2a3efb74 100644
--- a/src/addr2line.c
+++ b/src/addr2line.c
@@ -69,6 +69,7 @@ static const struct argp_option options[] =
N_("Show absolute file names using compilation directory"), 0 },
{ "functions", 'f', NULL, 0, N_("Also show function names"), 0 },
{ "symbols", 'S', NULL, 0, N_("Also show symbol or section names"), 0 },
+ { "flags", 'F', NULL, 0, N_("Also show line table flags"), 0 },
{ "section", 'j', "NAME", 0,
N_("Treat addresses as offsets relative to NAME section."), 0 },
@@ -109,6 +110,9 @@ static bool only_basenames;
/* True if absolute file names based on DW_AT_comp_dir should be shown. */
static bool use_comp_dir;
+/* True if line flags should be shown. */
+static bool show_flags;
+
/* True if function names should be shown. */
static bool show_functions;
@@ -219,6 +223,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
show_functions = true;
break;
+ case 'F':
+ show_flags = true;
+ break;
+
case 'S':
show_symbols = true;
break;
@@ -521,11 +529,41 @@ handle_address (const char *string, Dwfl *dwfl)
}
if (linecol != 0)
- printf ("%s%s%s:%d:%d\n",
+ printf ("%s%s%s:%d:%d",
comp_dir, comp_dir_sep, src, lineno, linecol);
else
- printf ("%s%s%s:%d\n",
+ printf ("%s%s%s:%d",
comp_dir, comp_dir_sep, src, lineno);
+
+ if (show_flags)
+ {
+ Dwarf_Addr bias;
+ Dwarf_Line *info = dwfl_dwarf_line (line, &bias);
+ assert (info != NULL);
+
+ inline void show (int (*get) (Dwarf_Line *, bool *),
+ const char *note)
+ {
+ bool flag;
+ if ((*get) (info, &flag) == 0 && flag)
+ fputs (note, stdout);
+ }
+ inline void show_int (int (*get) (Dwarf_Line *, unsigned int *),
+ const char *name)
+ {
+ unsigned int val;
+ if ((*get) (info, &val) == 0 && val != 0)
+ printf (" (%s %u)", name, val);
+ }
+
+ show (&dwarf_linebeginstatement, " (is_stmt)");
+ show (&dwarf_lineblock, " (basic_block)");
+ show (&dwarf_lineprologueend, " (prologue_end)");
+ show (&dwarf_lineepiloguebegin, " (epilogue_begin)");
+ show_int (&dwarf_lineisa, "isa");
+ show_int (&dwarf_linediscriminator, "discriminator");
+ }
+ putchar ('\n');
}
else
puts ("??:0");