From 2df78f1c49274971b2235d59700192a5d7023dd6 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 23 Jan 2015 15:03:01 -0800 Subject: [PATCH] Tolerate missing line records in prologue search If we're trying to scan line records for the function prologue, but the current CU fails dwarf_getsrclines(), then just return so we can probe without skipping prologues. Such CUs were seen for the jemalloc sources built into Rust's libstd. For some reason these don't have any DW_AT_stmt_list at all! --- dwflpp.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dwflpp.cxx b/dwflpp.cxx index c96ef3f67..90cb8c06b 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -2274,8 +2274,14 @@ dwflpp::resolve_prologue_endings (func_info_map_t & funcs) // Fetch all srcline records, sorted by address. No need to free lines, it's a // direct pointer to the CU's cached lines. - DWARF_ASSERT ("dwarf_getsrclines", - dwarf_getsrclines(cu, &lines, &nlines)); + if (dwarf_getsrclines(cu, &lines, &nlines) != 0 + || lines == NULL || nlines == 0) + { + if (sess.verbose > 2) + clog << _F("aborting prologue search: no source lines found for cu '%s'\n", + cu_name().c_str()); + return; + } // Dump them into our own array for easier searching. They should already be // sorted by addr, but we doublecheck that here. We want to keep the indices -- 2.43.5