gdb/dwarf: remove line_header::total_length field
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 12 Apr 2022 19:31:24 +0000 (15:31 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 21 Apr 2022 19:05:51 +0000 (15:05 -0400)
This doesn' have to be a field, it can simply be a local variable in
dwarf_decode_line_header.  Name the local variable "unit_length", since
that's what the field in called in DWARF 4 and 5.  It's always easier to
follow the code with the standard on the side when we use the same
terminology.

Change-Id: I3ad1022afd9410b193ea11b9b5437686c1e4e633

gdb/dwarf2/line-header.c
gdb/dwarf2/line-header.h

index 8f4eb4f124cf36c6d2f71fd6f0af8dd8a185cf85..9a5f3fabe8d92998707dc59029d8d56453815590 100644 (file)
@@ -289,19 +289,19 @@ dwarf_decode_line_header  (sect_offset sect_off, bool is_dwz,
   line_ptr = section->buffer + to_underlying (sect_off);
 
   /* Read in the header.  */
-  lh->total_length =
-    read_checked_initial_length_and_offset (abfd, line_ptr, cu_header,
-                                           &bytes_read, &offset_size);
+  LONGEST unit_length
+    read_checked_initial_length_and_offset (abfd, line_ptr, cu_header,
+                                             &bytes_read, &offset_size);
   line_ptr += bytes_read;
 
   const gdb_byte *start_here = line_ptr;
 
-  if (line_ptr + lh->total_length > (section->buffer + section->size))
+  if (line_ptr + unit_length > (section->buffer + section->size))
     {
       dwarf2_statement_list_fits_in_line_number_section_complaint ();
       return 0;
     }
-  lh->statement_program_end = start_here + lh->total_length;
+  lh->statement_program_end = start_here + unit_length;
   lh->version = read_2_bytes (abfd, line_ptr);
   line_ptr += 2;
   if (lh->version > 5)
index 4adfe91b8ac43ed531c507c40408ab847e424cb4..25b9e7c2032717631a3aecf7205903efc1436161 100644 (file)
@@ -136,7 +136,6 @@ struct line_header
   /* OFFSET is for struct dwz_file associated with dwarf2_per_objfile.  */
   unsigned offset_in_dwz : 1; /* Can't initialize bitfields in-class.  */
 
-  unsigned int total_length {};
   unsigned short version {};
   unsigned int header_length {};
   unsigned char minimum_instruction_length {};