This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

DWARF2 line number problem


I have a problem and I'm not sure what the correct solution would be. 

I'm looking at gcc mips output.  The compilation unit says pointer size is 4, 
but the DWARF line section is setting the address to a sign-extended 8-byte 
value.  GDB cleverly ignores the actual size of the extended opcode and reads 
a 4-byte value then starts parsing the rest of the bytes as line opcodes!

Is it OK for DWARF to have 8-byte sign-extended addresses in a CU where the 
pointer size is 4 bytes?

How to fix GDB?  The problem is in dwarf_decode_lines() and there is even a 
comment documenting the bug ("ignore length").

           case DW_LNS_extended_op:
	      line_ptr += 1;	/* ignore length */
	      extended_op = read_1_byte (abfd, line_ptr);
	      line_ptr += 1;

Obviously we must check the length.  If we decide we must accept 8-byte 
lengths, then I guess we simply advance the pointer by 4 bytes before reading 
(for big-endian) or after reading (for little endian).  Any better 
suggestions?

-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.


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