Convert dwarf2_section_buffer_overflow_complaint to a method
authorTom Tromey <tom@tromey.com>
Thu, 26 Mar 2020 15:28:08 +0000 (09:28 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 26 Mar 2020 15:28:13 +0000 (09:28 -0600)
This changes dwarf2_section_buffer_overflow_complaint to be a method
on dwarf2_section_info.

gdb/ChangeLog
2020-03-26  Tom Tromey  <tom@tromey.com>

* dwarf2/section.h (struct dwarf2_section_info)
<overload_complaint>: Declare.
(dwarf2_section_buffer_overflow_complaint): Don't declare.
* dwarf2/section.c (dwarf2_section_info::overflow_complaint):
Rename from dwarf2_section_buffer_overflow_complaint.
* dwarf2/read.c (skip_one_die, partial_die_info::read)
(skip_form_bytes, dwarf_decode_macro_bytes): Update.

gdb/ChangeLog
gdb/dwarf2/read.c
gdb/dwarf2/section.c
gdb/dwarf2/section.h

index aa462adb6f8b1b2a5bb0b1b169a007cc93f29821..236f552024a8f8f1ab0e1fa5c6268bbabf8ffc22 100644 (file)
@@ -1,3 +1,13 @@
+2020-03-26  Tom Tromey  <tom@tromey.com>
+
+       * dwarf2/section.h (struct dwarf2_section_info)
+       <overload_complaint>: Declare.
+       (dwarf2_section_buffer_overflow_complaint): Don't declare.
+       * dwarf2/section.c (dwarf2_section_info::overflow_complaint):
+       Rename from dwarf2_section_buffer_overflow_complaint.
+       * dwarf2/read.c (skip_one_die, partial_die_info::read)
+       (skip_form_bytes, dwarf_decode_macro_bytes): Update.
+
 2020-03-26  Tom Tromey  <tom@tromey.com>
 
        * dwarf2/section.h (dwarf2_section_buffer_overflow_complaint):
index f42058fb7740b91ee96857f0f70b393a92d606a3..f284d623081c661051204a40d8a0217fa0e2e168 100644 (file)
@@ -8595,7 +8595,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
              if (sibling_ptr < info_ptr)
                complaint (_("DW_AT_sibling points backwards"));
              else if (sibling_ptr > reader->buffer_end)
-               dwarf2_section_buffer_overflow_complaint (reader->die_section);
+               reader->die_section->overflow_complaint ();
              else
                return sibling_ptr;
            }
@@ -18079,7 +18079,7 @@ partial_die_info::read (const struct die_reader_specs *reader,
              if (sibling_ptr < info_ptr)
                complaint (_("DW_AT_sibling points backwards"));
              else if (sibling_ptr > reader->buffer_end)
-               dwarf2_section_buffer_overflow_complaint (reader->die_section);
+               reader->die_section->overflow_complaint ();
              else
                sibling = sibling_ptr;
            }
@@ -23329,7 +23329,7 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
       bytes = gdb_skip_leb128 (bytes, buffer_end);
       if (bytes == NULL)
        {
-         dwarf2_section_buffer_overflow_complaint (section);
+         section->overflow_complaint ();
          return NULL;
        }
       break;
@@ -23492,7 +23492,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
       /* Do we at least have room for a macinfo type byte?  */
       if (mac_ptr >= mac_end)
        {
-         dwarf2_section_buffer_overflow_complaint (section);
+         section->overflow_complaint ();
          break;
        }
 
@@ -23645,7 +23645,7 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile,
                   /* Do we at least have room for a macinfo type byte?  */
                   if (mac_ptr >= mac_end)
                     {
-                     dwarf2_section_buffer_overflow_complaint (section);
+                     section->overflow_complaint ();
                       return;
                     }
 
index 31cb8b9b2e759faa3b07f16bc4fb67dad0b2eea4..9714368a5d29b820f4149f163553677b4787fbb9 100644 (file)
 #include "complaints.h"
 
 void
-dwarf2_section_buffer_overflow_complaint (struct dwarf2_section_info *section)
+dwarf2_section_info::overflow_complaint () const
 {
   complaint (_("debug info runs off end of %s section"
               " [in module %s]"),
-            section->get_name (),
-            section->get_file_name ());
+            get_name (), get_file_name ());
 }
 
 struct dwarf2_section_info *
index f4ac9af311e26a5195504fe5a92dbaff19282b9f..555efecacd650a6f3e1ae2b9878f1f7929872919 100644 (file)
@@ -94,6 +94,10 @@ struct dwarf2_section_info
     return size;
   }
 
+  /* Issue a complaint that something was outside the bounds of this
+     buffer.  */
+  void overflow_complaint () const;
+
   union
   {
     /* If this is a real section, the bfd section.  */
@@ -116,7 +120,4 @@ struct dwarf2_section_info
   bool is_virtual;
 };
 
-extern void dwarf2_section_buffer_overflow_complaint
-  (struct dwarf2_section_info *section);
-
 #endif /* GDB_DWARF2_SECTION_H */