From a43d3fbfdd210884540b048d0a033792a3811468 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Tue, 25 Feb 2014 14:50:04 -0500 Subject: [PATCH] dwflpp/prologue: don't skip the first line record Don't skip the first line record. It may correspond to a different file than it->decl_file, in which case it's a naked prologue. --- dwflpp.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dwflpp.cxx b/dwflpp.cxx index d957d7eff..7a91d16ad 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -2137,13 +2137,13 @@ dwflpp::resolve_prologue_endings (func_info_map_t & funcs) // the entrypc maps to a statement in the body rather than the // declaration. - // start search from the next line record - unsigned postprologue_srcline_idx = entrypc_srcline_idx+1; + int entrypc_srcline_lineno = entrypc_srcline.lineno(); + unsigned postprologue_srcline_idx = entrypc_srcline_idx; bool ranoff_end = false; - // In 99% of cases, this while loop will break on the first iteration - // because of a higher/same lineno. In the rare cases line records are for - // a lower lineno, we keep traversing records. + // For 0-line advances, this while loop will break on the second + // iteration. It may also break on the first iteration if the filenames + // don't match. while (postprologue_srcline_idx < nlines) { dwarf_line_t lr(dwarf_onesrcline(lines, postprologue_srcline_idx)); @@ -2164,7 +2164,8 @@ dwflpp::resolve_prologue_endings (func_info_map_t & funcs) } if (ranoff_end || postprologue_end || (strcmp (postprologue_file, it->decl_file) || // We have a winner! - (postprologue_lineno >= entrypc_srcline.lineno()))) + (postprologue_lineno != entrypc_srcline_lineno) || + (postprologue_srcline_idx > entrypc_srcline_idx))) { it->prologue_end = postprologue_addr; -- 2.43.5