public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/dwarf: remove line_header::total_length field
Date: Thu, 21 Apr 2022 19:06:06 +0000 (GMT)	[thread overview]
Message-ID: <20220421190606.0CF393858D37@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebf58f8eb185e49fa4ed05b5e2ff5d703229b9b7

commit ebf58f8eb185e49fa4ed05b5e2ff5d703229b9b7
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Tue Apr 12 15:31:24 2022 -0400

    gdb/dwarf: remove line_header::total_length field
    
    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

Diff:
---
 gdb/dwarf2/line-header.c | 10 +++++-----
 gdb/dwarf2/line-header.h |  1 -
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c
index 8f4eb4f124c..9a5f3fabe8d 100644
--- a/gdb/dwarf2/line-header.c
+++ b/gdb/dwarf2/line-header.c
@@ -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)
diff --git a/gdb/dwarf2/line-header.h b/gdb/dwarf2/line-header.h
index 4adfe91b8ac..25b9e7c2032 100644
--- a/gdb/dwarf2/line-header.h
+++ b/gdb/dwarf2/line-header.h
@@ -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 {};


                 reply	other threads:[~2022-04-21 19:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220421190606.0CF393858D37@sourceware.org \
    --to=simark@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).