aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-11-15 18:49:50 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-11-15 18:49:50 +0000
commit59205f5a0e00226f1a7768e1f2274d0821db7aab (patch)
treec1cf27972b8f67c21ce756a50b5be9d20fe8e7d1
parent00b22944a0788c0c81fa72629c287e982e9fe2b7 (diff)
downloadgdb-59205f5a0e00226f1a7768e1f2274d0821db7aab.zip
gdb-59205f5a0e00226f1a7768e1f2274d0821db7aab.tar.gz
gdb-59205f5a0e00226f1a7768e1f2274d0821db7aab.tar.bz2
From Jerome Guitton <guitton@adacore.com>
* dwarf2read.c (dwarf2_debug_line_missing_end_sequence_complaint): New function. (dwarf_decode_lines): Detect null file numbers. Detect the end of the line program sequence when no end sequence is emitted.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/dwarf2read.c35
2 files changed, 31 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 36d6592..26c4240 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2008-11-15 Joel Brobecker <brobecker@adacore.com>
+ From Jerome Guitton <guitton@adacore.com>
+ * dwarf2read.c (dwarf2_debug_line_missing_end_sequence_complaint):
+ New function.
+ (dwarf_decode_lines): Detect null file numbers. Detect the end of
+ the line program sequence when no end sequence is emitted.
+
+2008-11-15 Joel Brobecker <brobecker@adacore.com>
+
* ada-lang.c (ada_evaluate_subexp): Improve handling of integer
type dereferencing.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ba863fe..a6584c4 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -700,6 +700,13 @@ dwarf2_debug_line_missing_file_complaint (void)
}
static void
+dwarf2_debug_line_missing_end_sequence_complaint (void)
+{
+ complaint (&symfile_complaints,
+ _(".debug_line section has line program sequence without an end"));
+}
+
+static void
dwarf2_complex_location_expr_complaint (void)
{
complaint (&symfile_complaints, _("location expression too complex"));
@@ -7092,6 +7099,11 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
{
op_code = read_1_byte (abfd, line_ptr);
line_ptr += 1;
+ if (line_ptr > line_end)
+ {
+ dwarf2_debug_line_missing_end_sequence_complaint ();
+ break;
+ }
if (op_code >= lh->opcode_base)
{
@@ -7100,7 +7112,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
address += (adj_opcode / lh->line_range)
* lh->minimum_instruction_length;
line += lh->line_base + (adj_opcode % lh->line_range);
- if (lh->num_file_names < file)
+ if (lh->num_file_names < file || file == 0)
dwarf2_debug_line_missing_file_complaint ();
else
{
@@ -7132,15 +7144,6 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
{
case DW_LNE_end_sequence:
end_sequence = 1;
-
- if (lh->num_file_names < file)
- dwarf2_debug_line_missing_file_complaint ();
- else
- {
- lh->file_names[file - 1].included_p = 1;
- if (!decode_for_pst_p)
- record_line (current_subfile, 0, address);
- }
break;
case DW_LNE_set_address:
address = read_address (abfd, line_ptr, cu, &bytes_read);
@@ -7182,7 +7185,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
}
break;
case DW_LNS_copy:
- if (lh->num_file_names < file)
+ if (lh->num_file_names < file || file == 0)
dwarf2_debug_line_missing_file_complaint ();
else
{
@@ -7220,7 +7223,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
- if (lh->num_file_names < file)
+ if (lh->num_file_names < file || file == 0)
dwarf2_debug_line_missing_file_complaint ();
else
{
@@ -7271,6 +7274,14 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
}
}
}
+ if (lh->num_file_names < file || file == 0)
+ dwarf2_debug_line_missing_file_complaint ();
+ else
+ {
+ lh->file_names[file - 1].included_p = 1;
+ if (!decode_for_pst_p)
+ record_line (current_subfile, 0, address);
+ }
}
if (decode_for_pst_p)