From ab071889a98a434e1454d66539f987732c5d099e Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Thu, 15 Jan 2015 13:48:31 -0800 Subject: [PATCH] Fix problems with DW_LNS_pop_context in logicals table. 2015-01-15 Cary Coutant gas/ * dwarf2dbg.c (emit_logicals): Fix bug in generating DW_LNS_pop_context. (process_entries): Don't always emit DW_LNS_set_address_from_logical when crossing frag boundaries. --- gas/dwarf2dbg.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 811feb109f4..d9edc0bcb9a 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1546,7 +1546,7 @@ emit_logicals (void) if (context != e->context || subprog != e->subprog) { - unsigned int caller = e->context; + unsigned int caller = context; unsigned int npop = 0; // See if a sequence of DW_LNS_pop_context ops will get @@ -1554,7 +1554,7 @@ emit_logicals (void) while (caller > 0 && caller <= logicals_in_use) { ++npop; - if (logicals[caller - 1].subprog == subprog) + if (logicals[caller - 1].subprog == e->subprog) break; caller = logicals[caller - 1].context; } @@ -1757,17 +1757,18 @@ process_entries (segT seg, struct line_entry *e) frag = symbol_get_frag (lab); frag_ofs = S_GET_VALUE (lab); - if (logicals_in_use > 0 - && frag != last_frag - && logicals[e->loc.logical - 1].label == lab) + if (last_frag == NULL) { - out_set_addr_from_logical (line_delta); - out_opcode (DW_LNS_copy); - } - else if (last_frag == NULL) - { - out_set_addr (lab); - out_inc_line_addr (line_delta, 0); + if (logicals_in_use > 0 && logicals[e->loc.logical - 1].label == lab) + { + out_set_addr_from_logical (line_delta); + out_opcode (DW_LNS_copy); + } + else + { + out_set_addr (lab); + out_inc_line_addr (line_delta, 0); + } } else if (frag == last_frag && ! DWARF2_USE_FIXED_ADVANCE_PC) out_inc_line_addr (line_delta, frag_ofs - last_frag_ofs); -- 2.47.2