summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getsrclines.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-18 00:26:56 +0200
committerMark Wielaard <[email protected]>2018-05-22 15:49:22 +0200
commita4c74cc67de22cb3208fc768989c509d6837cd77 (patch)
tree54e0928f75a58ff4dd6cc11103daa67489e27780 /libdw/dwarf_getsrclines.c
parent46d5523c94b5e9c830aeba9de863e1b65b08b1df (diff)
libdw: Handle split dwarf debuglines.
Split DWARF .dwo files do contain a .debug_line section, but only with the file table, there is no actual line program. Also split DWARF CU DIEs don't have a DW_AT_stmt_list attribute. To get at the file (and dir) table for a split unit DIE take just the files from the .debug_line section (at offset zero). To get the full line table use the skeleton DIE (which does have a DW_AT_stmt_list). Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdw/dwarf_getsrclines.c')
-rw-r--r--libdw/dwarf_getsrclines.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c
index 2f966ab7..2bf30984 100644
--- a/libdw/dwarf_getsrclines.c
+++ b/libdw/dwarf_getsrclines.c
@@ -1147,6 +1147,31 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
struct Dwarf_CU *const cu = cudie->cu;
if (cu->lines == NULL)
{
+ /* For split units always pick the lines from the skeleton. */
+ if (cu->unit_type == DW_UT_split_compile
+ || cu->unit_type == DW_UT_split_type)
+ {
+ /* We tries, assume we fail... */
+ cu->lines = (void *) -1l;
+
+ Dwarf_CU *skel = __libdw_find_split_unit (cu);
+ if (skel != NULL)
+ {
+ Dwarf_Die skeldie = CUDIE (skel);
+ int res = INTUSE(dwarf_getsrclines) (&skeldie, lines, nlines);
+ if (res == 0)
+ {
+ cu->lines = skel->lines;
+ *lines = cu->lines;
+ *nlines = cu->lines->nlines;
+ }
+ return res;
+ }
+
+ __libdw_seterrno (DWARF_E_NO_DEBUG_LINE);
+ return -1;
+ }
+
/* Failsafe mode: no data found. */
cu->lines = (void *) -1l;
cu->files = (void *) -1l;