]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Update DW_LNS opcodes for two-level line tables.
authorCary Coutant <ccoutant@google.com>
Fri, 23 Jan 2015 21:12:29 +0000 (13:12 -0800)
committerCary Coutant <ccoutant@google.com>
Fri, 23 Jan 2015 21:12:29 +0000 (13:12 -0800)
2015-01-23  Cary Coutant  <ccoutant@google.com>

gas/
* dwarf2dbg.c (emit_logicals): Increase max number of
DW_LNS_pop_context opcodes. Change DW_LNS_set_context
to DW_LNS_inlined_call.
(out_debug_line): Adjust operand lengths array.

gas/dwarf2dbg.c

index d9edc0bcb9abfe016c54b00a65e8301708111218..506eedf55c700d1137c6167f8b9fd8ebaf895d74 100644 (file)
@@ -1540,6 +1540,7 @@ emit_logicals (void)
   for (logical = 1; logical <= logicals_in_use; ++logical)
     {
       int line_delta;
+      int context_delta;
       struct logicals_entry *e = &logicals[logical - 1];
 
       discriminator = 0;
@@ -1558,7 +1559,7 @@ emit_logicals (void)
                break;
              caller = logicals[caller - 1].context;
            }
-         if (caller > 0 && caller <= logicals_in_use && npop < 5)
+         if (caller > 0 && caller <= logicals_in_use && npop < 10)
            {
              while (npop-- > 0)
                out_opcode (DW_LNS_pop_context);
@@ -1570,16 +1571,20 @@ emit_logicals (void)
              context = logicals[caller - 1].context;
              subprog = logicals[caller - 1].subprog;
            }
-         if (context != e->context)
+         if (context != e->context && e->context == 0)
            {
-             context = e->context;
-             out_opcode (DW_LNS_set_context);
-             out_uleb128 (context);
+             context = 0;
+             subprog = e->subprog;
+             out_opcode (DW_LNS_set_subprogram);
+             out_uleb128 (subprog);
            }
-         if (subprog != e->subprog)
+         else if (context != e->context || subprog != e->subprog)
            {
+             context_delta = e->context - (logical - 1);
+             context = e->context;
              subprog = e->subprog;
-             out_opcode (DW_LNS_set_subprogram);
+             out_opcode (DW_LNS_inlined_call);
+             out_leb128 (context_delta);
              out_uleb128 (subprog);
            }
        }
@@ -2120,8 +2125,8 @@ out_debug_line (segT line_seg, segT str_seg)
   out_byte (1);                        /* DW_LNS_set_isa */
   if (opcode_base == DWARF2_EXPERIMENTAL_LINE_OPCODE_BASE)
     {
-      out_byte (1);            /* DW_LNS_set_context/DW_LNS_set_address_from_logical */
-      out_byte (1);            /* DW_LNS_set_subprogram */
+      out_byte (1);            /* DW_LNS_set_subprogram/DW_LNS_set_address_from_logical */
+      out_byte (2);            /* DW_LNS_inlined_call */
       out_byte (0);            /* DW_LNS_pop_context */
     }