This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] dwarf2read - empty file name table
- From: Jerome Guitton <guitton at adacore dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 19 Apr 2007 16:16:47 +0200
- Subject: [RFA] dwarf2read - empty file name table
I am using a third-party library which makes GDB crash; it has the
following entry in its .debug_line:
[...]
Dump of debug contents of section .debug_line:
Length: 35
DWARF Version: 2
Prologue Length: 19
Minimum Instruction Length: 4
Initial value of 'is_stmt': 1
Line Base: -1
Line Range: 4
Opcode Base: 13
(Pointer size: 4)
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
The Directory Table is empty.
The File Name Table is empty.
Line Number Statements:
Extended opcode 2: set Address to 0x10000
Extended opcode 1: End of Sequence
[...]
Note that the file name table is empty and that no file name is
specified in the line number statements. Not sure what is the use of
such an entry, but it does not seem invalid to me. Anyway, this makes
GDB crash in dwarf2read.c (trying to read into a num file name table
at End of Sequence). The followwing patch should fix this problem.
Ok to apply?
Thanks in advance,
Jerome
2007-04-19 Jerome Guitton <guitton@adacore.com>
* dwarf2read.c (dwarf_decode_lines): Do not dereference file_names
if NULL.
Index: dwarf2read.c
===================================================================
--- dwarf2read.c (revision 6081)
+++ dwarf2read.c (revision 6082)
@@ -6996,7 +6996,8 @@
{
case DW_LNE_end_sequence:
end_sequence = 1;
- lh->file_names[file - 1].included_p = 1;
+ if (lh->file_names_size)
+ lh->file_names[file - 1].included_p = 1;
if (!decode_for_pst_p)
record_line (current_subfile, 0, address);
break;