Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jerome Guitton <guitton@adacore.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] dwarf2read - empty file name table
Date: Thu, 19 Apr 2007 14:23:00 -0000	[thread overview]
Message-ID: <20070419141647.GA53265@adacore.com> (raw)


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;


             reply	other threads:[~2007-04-19 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-19 14:23 Jerome Guitton [this message]
2007-04-19 15:06 ` Daniel Jacobowitz
2007-04-19 19:39   ` Jerome Guitton
2007-05-14 17:15     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070419141647.GA53265@adacore.com \
    --to=guitton@adacore.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox