[gdb/symtab] Use comp_unit_head::get_length
authorTom de Vries <tdevries@suse.de>
Mon, 11 Jul 2022 09:36:54 +0000 (11:36 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 11 Jul 2022 09:36:54 +0000 (11:36 +0200)
There's a spot in read_comp_units_from_section where we explictly use
initial_length_size to get the total length:
...
      this_cu->length = cu_header.length + cu_header.initial_length_size;
...

Instead, just use cu_header.get_length ().

Tested on x86_64-linux.

gdb/dwarf2/read.c

index 55e61b882a995a86c7d8907e367e4ca1e65bf868..40a18796f8d2319716d96f2cbf20f82640cc02ce 100644 (file)
@@ -7207,7 +7207,7 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
          *slot = sig_ptr;
        }
       this_cu->sect_off = sect_off;
-      this_cu->length = cu_header.length + cu_header.initial_length_size;
+      this_cu->length = cu_header.get_length ();
       this_cu->is_dwz = is_dwz;
       this_cu->section = section;
       /* Init this asap, to avoid a data race in the set_version in