]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/dwarf: change read_loclist_index complaints into errors
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 2 Feb 2021 15:40:50 +0000 (10:40 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Wed, 3 Feb 2021 14:51:49 +0000 (09:51 -0500)
Unlike read_rnglists_index, read_loclist_index uses complaints when it
detects an inconsistency (a DW_FORM_loclistx value without a
.debug_loclists section or an offset outside of the section).  I really
think they should be errors, since there's no point in continuing if
this situation happens, we will likely segfault or read garbage.

gdb/ChangeLog:

* dwarf2/read.c (read_loclist_index): Change complaints into
errors.

Change-Id: Ic3a1cf6e682d47cb6e739dd76fd7ca5be2637e10

gdb/ChangeLog
gdb/dwarf2/read.c

index dd7dcea3503abf5aa0c94374580abb025a44183d..56b3e3a390815c7bb09408f197a4b9b700d88fea 100644 (file)
@@ -1,3 +1,8 @@
+2021-02-02  Simon Marchi  <simon.marchi@efficios.com>
+
+       * dwarf2/read.c (read_loclist_index): Change complaints into
+       errors.
+
 2021-01-08  Tom de Vries  <tdevries@suse.de>
 
        PR gdb/26881
index 80df6baef6373ad0e0691dd9ea24093300ab5eec..b5ca65fd63b3f5039c0c1aa9c5d76a05485dd811 100644 (file)
@@ -19534,19 +19534,22 @@ read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index)
 
   section->read (objfile);
   if (section->buffer == NULL)
-    complaint (_("DW_FORM_loclistx used without .debug_loclists "
-               "section [in module %s]"), objfile_name (objfile));
+    error (_("DW_FORM_loclistx used without .debug_loclists "
+            "section [in module %s]"), objfile_name (objfile));
+
   struct loclists_rnglists_header header;
   read_loclists_rnglists_header (&header, section);
   if (loclist_index >= header.offset_entry_count)
-    complaint (_("DW_FORM_loclistx pointing outside of "
-               ".debug_loclists offset array [in module %s]"),
-               objfile_name (objfile));
+    error (_("DW_FORM_loclistx pointing outside of "
+            ".debug_loclists offset array [in module %s]"),
+          objfile_name (objfile));
+
   if (loclist_base + loclist_index * cu->header.offset_size
        >= section->size)
-    complaint (_("DW_FORM_loclistx pointing outside of "
-               ".debug_loclists section [in module %s]"),
-               objfile_name (objfile));
+    error (_("DW_FORM_loclistx pointing outside of "
+            ".debug_loclists section [in module %s]"),
+          objfile_name (objfile));
+
   const gdb_byte *info_ptr
     = section->buffer + loclist_base + loclist_index * cu->header.offset_size;