]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix problems with DW_LNS_pop_context in logicals table.
authorCary Coutant <ccoutant@google.com>
Thu, 15 Jan 2015 21:48:31 +0000 (13:48 -0800)
committerCary Coutant <ccoutant@google.com>
Thu, 15 Jan 2015 21:58:47 +0000 (13:58 -0800)
2015-01-15  Cary Coutant  <ccoutant@google.com>

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

index 811feb109f4efc9c2c5d91bbc6dcd87b95e48413..d9edc0bcb9abfe016c54b00a65e8301708111218 100644 (file)
@@ -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);