]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* NEWS: Add item about discriminator support.
authorCary Coutant <ccoutant@google.com>
Fri, 24 Apr 2009 18:31:29 +0000 (18:31 +0000)
committerCary Coutant <ccoutant@google.com>
Fri, 24 Apr 2009 18:31:29 +0000 (18:31 +0000)
* dwarf2dbg.h (struct dwarf2_line_info): Add discriminator field.
* dwarf2dbg.c (current): Add discriminator field.
(dwarf2_where): Copy discriminator value.
(dwarf2_consume_line_info): Set discriminator to 0.
(dwarf2_directive_loc): Process discriminator sub-op.
(out_leb128): New function.
(process_entries): Output DW_LNE_set_discriminator.
* doc/as.texinfo: Add discriminator operand to .loc directive.
* testsuite/gas/lns/lns-common-1.d: Add test for discriminator.
* testsuite/gas/lns/lns-common-1.s: Likewise.

gas/ChangeLog
gas/NEWS
gas/doc/as.texinfo
gas/dwarf2dbg.c
gas/dwarf2dbg.h
gas/testsuite/gas/lns/lns-common-1.d
gas/testsuite/gas/lns/lns-common-1.s

index 70b9a1e5d69aac9df840356dfe6abadb47b246fb..ca8122769aa1b71b6c07f4c8a8a962443deceace 100644 (file)
@@ -1,3 +1,17 @@
+2009-04-24  Cary Coutant  <ccoutant@google.com>
+
+       * NEWS: Add item about discriminator support.
+       * dwarf2dbg.h (struct dwarf2_line_info): Add discriminator field.
+       * dwarf2dbg.c (current): Add discriminator field.
+       (dwarf2_where): Copy discriminator value.
+       (dwarf2_consume_line_info): Set discriminator to 0.
+       (dwarf2_directive_loc): Process discriminator sub-op.
+       (out_leb128): New function.
+       (process_entries): Output DW_LNE_set_discriminator.
+       * doc/as.texinfo: Add discriminator operand to .loc directive.
+       * testsuite/gas/lns/lns-common-1.d: Add test for discriminator.
+       * testsuite/gas/lns/lns-common-1.s: Likewise.
+
 2009-04-22  Nathan Sidwell  <nathan@codesourcery.com>
 
        * config/tc-mips.c (macro_end, md_convert_frag): Use '%s' for
index d4a69189fa6f367c891a854323c7a212f85915a9..e94438f0c002e09414af10f0b9f66c1b0c8b88f3 100644 (file)
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,5 +1,8 @@
 -*- text -*-
 
+* Add support for the new discriminator column in the DWARF line table,
+  with a discriminator operand for the .loc directive.
+
 * Add support for Sunplus score architecture.
 
 * Add support for Lattice Mico32 (lm32) architecture.
index f43e5380b2591914ff54ec2f5ab13422374e940c..682b368a6b6ea7cf49e13bb5196de28246cc0b74 100644 (file)
@@ -5108,6 +5108,10 @@ either 0 or 1.
 This directive will set the @code{isa} register in the @code{.debug_line}
 state machine to @var{value}, which must be an unsigned integer.
 
+@item discriminator @var{value}
+This directive will set the @code{discriminator} register in the @code{.debug_line}
+state machine to @var{value}, which must be an unsigned integer.
+
 @end table
 
 @node Loc_mark_labels
index f332865d5a6befc91454c997bbe760fa265cef88..48a1ae7ba61f78b8b6924fd6c8b91ca888dcdd5f 100644 (file)
@@ -25,7 +25,8 @@
 
        .file FILENO "file.c"
        .loc  FILENO LINENO [COLUMN] [basic_block] [prologue_end] \
-             [epilogue_begin] [is_stmt VALUE] [isa VALUE]
+             [epilogue_begin] [is_stmt VALUE] [isa VALUE] \
+             [discriminator VALUE]
 */
 
 #include "as.h"
@@ -194,7 +195,8 @@ bfd_boolean dwarf2_loc_mark_labels;
 /* Current location as indicated by the most recent .loc directive.  */
 static struct dwarf2_line_info current = {
   1, 1, 0, 0,
-  DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0
+  DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0,
+  0
 };
 
 /* The size of an address on the target.  */
@@ -331,6 +333,7 @@ dwarf2_where (struct dwarf2_line_info *line)
       line->column = 0;
       line->flags = DWARF2_FLAG_IS_STMT;
       line->isa = current.isa;
+      line->discriminator = current.discriminator;
     }
   else
     *line = current;
@@ -379,6 +382,7 @@ dwarf2_consume_line_info (void)
   current.flags &= ~(DWARF2_FLAG_BASIC_BLOCK
                     | DWARF2_FLAG_PROLOGUE_END
                     | DWARF2_FLAG_EPILOGUE_BEGIN);
+  current.discriminator = 0;
 }
 
 /* Called for each (preferably code) label.  If dwarf2_loc_mark_labels
@@ -581,6 +585,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
 
   current.filenum = filenum;
   current.line = line;
+  current.discriminator = 0;
 
 #ifndef NO_LISTING
   if (listing)
@@ -659,6 +664,18 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
              return;
            }
        }
+      else if (strcmp (p, "discriminator") == 0)
+       {
+         *input_line_pointer = c;
+         value = get_absolute_expression ();
+         if (value >= 0)
+           current.discriminator = value;
+         else
+           {
+             as_bad (_("discriminator less than zero"));
+             return;
+           }
+       }
       else
        {
          as_bad (_("unknown .loc sub-directive `%s'"), p);
@@ -748,6 +765,14 @@ out_uleb128 (addressT value)
   output_leb128 (frag_more (sizeof_leb128 (value, 0)), value, 0);
 }
 
+/* Emit a signed "little-endian base 128" number.  */
+
+static void
+out_leb128 (addressT value)
+{
+  output_leb128 (frag_more (sizeof_leb128 (value, 1)), value, 1);
+}
+
 /* Emit a tuple for .debug_abbrev.  */
 
 static inline void
@@ -1208,6 +1233,14 @@ process_entries (segT seg, struct line_entry *e)
          out_uleb128 (column);
        }
 
+      if (e->loc.discriminator != 0)
+       {
+         out_opcode (DW_LNS_extended_op);
+         out_leb128 (1 + sizeof_leb128 (e->loc.discriminator, 0));
+         out_opcode (DW_LNE_set_discriminator);
+         out_uleb128 (e->loc.discriminator);
+       }
+
       if (isa != e->loc.isa)
        {
          isa = e->loc.isa;
index ee943ce3ea26287fe971faf9ec57ab927e0eef2b..3295bd85a9d94f58f63b9bd04f236c17942906b9 100644 (file)
@@ -34,6 +34,7 @@ struct dwarf2_line_info {
   unsigned int column;
   unsigned int isa;
   unsigned int flags;
+  unsigned int discriminator;
 };
 
 /* Implements the .file FILENO "FILENAME" directive.  FILENO can be 0
index 81b4e9f2e621278e600d3d9cdcd268f66b94e522..e28896f37d8465ec7a85ba3bd4b32c1c1a4e0f98 100644 (file)
@@ -21,6 +21,8 @@ Raw dump of debug contents of section \.debug_line:
   Special opcode .*: advance Address by .* to .* and Line by 1 to 6
   Set is_stmt to 1
   Special opcode .*: advance Address by .* to .* and Line by 1 to 7
+  Extended opcode 4: set Discriminator to 1
+  Special opcode .*: advance Address by .* to .* and Line by 0 to 7
   Advance PC by .* to .*
   Extended opcode 1: End of Sequence
 #...
index f1d590b457bb1a32cc48caf1cdd6633be995d010..2fef2bd5d10327861ff2567afcbdf468d2534e10 100644 (file)
@@ -13,3 +13,5 @@
        nop
        .loc 1 7 is_stmt 1
        nop
+       .loc 1 7 discriminator 1
+       nop