This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch for readelf dwarf2 debug_line bug


readelf is incorrectly decoding special opcodes found in the dwarf2 .debug_line
section.  It is accidentally adding the address offset into the line number
offset.

Gcc always emits special opcodes with the address offset equal to zero, so that
is probably why we haven't noticed this before.  The GNU as dwarf2 support
however does emit special opcodes with non-zero address offsets.  I am trying
to get this code working with gcc which is how I noticed this problem.

Note that I don't have binutils checkin priviledges, so someone else will have
to check this in unless someone grants such priviledges to me.
	
gas/dwarf2dbg.c patches will follow shortly.

Wed Aug 25 20:07:10 1999  Jim Wilson  <wilson@cygnus.com>

	* readelf.c (display_debug_lines, case default): Change second line
	setting	adv to use = not +=.

Index: readelf.c
===================================================================
RCS file: /cvs/cvsfiles/devo/binutils/readelf.c,v
retrieving revision 1.84
diff -p -r1.84 readelf.c
*** readelf.c	1999/08/09 10:27:04	1.84
--- readelf.c	1999/08/26 03:06:40
*************** display_debug_lines (section, start, fil
*** 4418,4424 ****
  	      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);
--- 4418,4424 ----
  	      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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]