Index: bfd/ChangeLog
authorGeoffrey Keating <geoffk@geoffk.org>
Tue, 13 Nov 2001 20:13:30 +0000 (20:13 +0000)
committerGeoffrey Keating <geoffk@geoffk.org>
Tue, 13 Nov 2001 20:13:30 +0000 (20:13 +0000)
2001-11-11  Geoffrey Keating  <geoffk@redhat.com>

* dwarf2.c (decode_line_info): Properly deal with unknown standard
opcodes.

Index: binutils/ChangeLog
2001-11-11  Geoffrey Keating  <geoffk@redhat.com>

* readelf.c (display_debug_lines): Deal with unknown standard
opcodes.  Handle DW_LNS_set_prologue_end, DW_LNS_set_epilogue_begin,
DW_LNS_set_isa.

Index: include/elf/ChangeLog
2001-11-11  Geoffrey Keating  <geoffk@redhat.com>

* dwarf2.h (dwarf_line_number_ops): Add DWARF 3 opcodes.

bfd/ChangeLog
bfd/dwarf2.c
binutils/ChangeLog
binutils/readelf.c
include/elf/ChangeLog
include/elf/dwarf2.h

index e37b504a469c58395b6ec730a2cac1986e33909e..164dd2ebccf925889105733087a4d4d2b9fe8a0d 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-13  Geoffrey Keating  <geoffk@redhat.com>
+
+       * dwarf2.c (decode_line_info): Properly deal with unknown standard
+       opcodes.
+
 2001-11-13  John Marshall  <jmarshall@acm.org>
            Alan Modra  <amodra@bigpond.net.au>
 
index 6edbc0b9b952b188e318fab14879ad548b055e6a..209cd8fb991f5be370144b97f568cf9e32bbc104 100644 (file)
@@ -979,7 +979,22 @@ decode_line_info (unit, stash)
          op_code = read_1_byte (abfd, line_ptr);
          line_ptr += 1;
 
-         switch (op_code)
+         if (op_code >= lh.opcode_base)
+           {           /* Special operand.  */
+             adj_opcode = op_code - lh.opcode_base;
+             address += (adj_opcode / lh.line_range)
+               * lh.minimum_instruction_length;
+             line += lh.line_base + (adj_opcode % lh.line_range);
+             /* Append row to matrix using current values.  */
+             add_line_info (table, address, filename, line, column, 0);
+             basic_block = 1;
+             if (need_low_pc)
+               {
+                 need_low_pc = 0;
+                 low_pc = address;
+               }
+           }
+         else switch (op_code)
            {
            case DW_LNS_extended_op:
              line_ptr += 1;    /* Ignore length.  */
@@ -1079,19 +1094,15 @@ decode_line_info (unit, stash)
              address += read_2_bytes (abfd, line_ptr);
              line_ptr += 2;
              break;
-           default:            /* Special operand.  */
-             adj_opcode = op_code - lh.opcode_base;
-             address += (adj_opcode / lh.line_range)
-               * lh.minimum_instruction_length;
-             line += lh.line_base + (adj_opcode % lh.line_range);
-             /* Append row to matrix using current values.  */
-             add_line_info (table, address, filename, line, column, 0);
-             basic_block = 1;
-             if (need_low_pc)
-               {
-                 need_low_pc = 0;
-                 low_pc = address;
-               }
+           default:
+             {  /* Unknown standard opcode, ignore it.  */
+               int i;
+               for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++)
+                 {
+                   (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+                   line_ptr += bytes_read;
+                 }
+             }
            }
        }
     }
index dc85cc1573c788a6bd8039ad7c77980c90792ab7..6fc2f629b1eabb71696aae7841506e771f36e6a8 100644 (file)
@@ -1,9 +1,16 @@
+2001-11-13  Geoffrey Keating  <geoffk@redhat.com>
+
+       * readelf.c (display_debug_lines): Deal with unknown standard
+       opcodes.  Handle DW_LNS_set_prologue_end, DW_LNS_set_epilogue_begin,
+       DW_LNS_set_isa.
+
 2001-11-13  Timothy Wall  <twall@alum.mit.edu>
+
        * MAINTAINERS: Add self as tic54x maintainer.  This target
        includes the IBM C54XDSP clone.
 
 2001-11-12  * Steven J. Hill <sjhill@realitydiluted.com>
-       
+
        * bucomm.c (make_tempname): Use mkstemp in place of mktemp.
 
 2001-11-09  Jeffrey A Law  (law@cygnus.com)
index a58200f8de1128bf5a3ccd455cf8a022668a745f..1d5300ae85a3a28aa8ab73a0cce1203bb8bc4936 100644 (file)
@@ -5888,7 +5888,19 @@ display_debug_lines (section, start, file)
 
          op_code = * data ++;
 
-         switch (op_code)
+         if (op_code >= info.li_opcode_base)
+           {
+             op_code -= info.li_opcode_base;
+             adv      = (op_code / info.li_line_range) * info.li_min_insn_length;
+             state_machine_regs.address += adv;
+             printf (_("  Special opcode %d: advance Address by %d to 0x%lx"),
+                     op_code, adv, state_machine_regs.address);
+             adv = (op_code % info.li_line_range) + info.li_line_base;
+             state_machine_regs.line += adv;
+             printf (_(" and Line by %d to %d\n"),
+                     adv, state_machine_regs.line);
+           } 
+         else switch (op_code) 
            {
            case DW_LNS_extended_op:
              data += process_extended_line_op (data, info.li_default_is_stmt,
@@ -5958,20 +5970,36 @@ display_debug_lines (section, start, file)
                      adv, state_machine_regs.address);
              break;
 
+           case DW_LNS_set_prologue_end:
+             printf (_("  Set prologue_end to true\n"));
+             break;
+             
+           case DW_LNS_set_epilogue_begin:
+             printf (_("  Set epilogue_begin to true\n"));
+             break;
+             
+           case DW_LNS_set_isa:
+             adv = read_leb128 (data, & bytes_read, 0);
+             data += bytes_read;
+             printf (_("  Set ISA to %d\n"), adv);
+             break;
+             
            default:
-             op_code -= info.li_opcode_base;
-             adv      = (op_code / info.li_line_range) * info.li_min_insn_length;
-             state_machine_regs.address += adv;
-             printf (_("  Special opcode %d: advance Address by %d to 0x%lx"),
-                     op_code, adv, state_machine_regs.address);
-             adv = (op_code % info.li_line_range) + info.li_line_base;
-             state_machine_regs.line += adv;
-             printf (_(" and Line by %d to %d\n"),
-                     adv, state_machine_regs.line);
+             printf (_("  Unknown opcode %d with operands: "), op_code);
+             {
+               int i;
+               for (i = standard_opcodes[op_code - 1]; i > 0 ; --i)
+                 {
+                   printf ("0x%lx%s", read_leb128 (data, &bytes_read, 0),
+                           i == 1 ? "" : ", ");
+                   data += bytes_read;
+                 }
+               putchar ('\n');
+             }
              break;
            }
        }
-      printf ("\n");
+      putchar ('\n');
     }
 
   return 1;
index 41b5e95731b0f64dce3bc29d293b3cc84bef6f88..5293de98186cf57d00c00c070701f991ebc537a9 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-11  Geoffrey Keating  <geoffk@redhat.com>
+
+       * dwarf2.h (dwarf_line_number_ops): Add DWARF 3 opcodes.
+
 2001-10-30  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * mmix.h: New file.
index d7c164088ba1803952429680502c069941edad9f..a99dca709e8be454d1949b3edf28158f11802c6f 100644 (file)
@@ -588,7 +588,11 @@ enum dwarf_line_number_ops
     DW_LNS_negate_stmt = 6,
     DW_LNS_set_basic_block = 7,
     DW_LNS_const_add_pc = 8,
-    DW_LNS_fixed_advance_pc = 9
+    DW_LNS_fixed_advance_pc = 9,
+    /* DWARF 3 */
+    DW_LNS_set_prologue_end = 10,
+    DW_LNS_set_epilogue_begin = 11,
+    DW_LNS_set_isa = 12
   };
 
 /* Line number extended opcodes.  */