From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [pushed] Use cu_header consistently in read_attribute_value
Date: Sun, 14 Mar 2021 12:03:14 -0600 [thread overview]
Message-ID: <20210314180314.380565-1-tom@tromey.com> (raw)
read_attribute_value has a local cu_header variable, but then some
spots in the function use cu->header instead. It seems better to me
to prefer the local everywhere, so this patch makes this change.
gdb/ChangeLog
2021-03-14 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_attribute_value): Use cu_header
consistently.
---
gdb/ChangeLog | 5 +++++
gdb/dwarf2/read.c | 22 +++++++++++-----------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index f625a618a6d..a4eb92c7d6f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -20332,23 +20332,23 @@ read_attribute_value (const struct die_reader_specs *reader,
switch (form)
{
case DW_FORM_ref_addr:
- if (cu->header.version == 2)
- attr->set_unsigned (cu->header.read_address (abfd, info_ptr,
+ if (cu_header->version == 2)
+ attr->set_unsigned (cu_header->read_address (abfd, info_ptr,
&bytes_read));
else
- attr->set_unsigned (cu->header.read_offset (abfd, info_ptr,
+ attr->set_unsigned (cu_header->read_offset (abfd, info_ptr,
&bytes_read));
info_ptr += bytes_read;
break;
case DW_FORM_GNU_ref_alt:
- attr->set_unsigned (cu->header.read_offset (abfd, info_ptr,
+ attr->set_unsigned (cu_header->read_offset (abfd, info_ptr,
&bytes_read));
info_ptr += bytes_read;
break;
case DW_FORM_addr:
{
struct gdbarch *gdbarch = objfile->arch ();
- CORE_ADDR addr = cu->header.read_address (abfd, info_ptr, &bytes_read);
+ CORE_ADDR addr = cu_header->read_address (abfd, info_ptr, &bytes_read);
addr = gdbarch_adjust_dwarf2_addr (gdbarch, addr);
attr->set_address (addr);
info_ptr += bytes_read;
@@ -20390,7 +20390,7 @@ read_attribute_value (const struct die_reader_specs *reader,
attr->set_block (blk);
break;
case DW_FORM_sec_offset:
- attr->set_unsigned (cu->header.read_offset (abfd, info_ptr,
+ attr->set_unsigned (cu_header->read_offset (abfd, info_ptr,
&bytes_read));
info_ptr += bytes_read;
break;
@@ -20479,22 +20479,22 @@ read_attribute_value (const struct die_reader_specs *reader,
info_ptr += bytes_read;
break;
case DW_FORM_ref1:
- attr->set_unsigned ((to_underlying (cu->header.sect_off)
+ attr->set_unsigned ((to_underlying (cu_header->sect_off)
+ read_1_byte (abfd, info_ptr)));
info_ptr += 1;
break;
case DW_FORM_ref2:
- attr->set_unsigned ((to_underlying (cu->header.sect_off)
+ attr->set_unsigned ((to_underlying (cu_header->sect_off)
+ read_2_bytes (abfd, info_ptr)));
info_ptr += 2;
break;
case DW_FORM_ref4:
- attr->set_unsigned ((to_underlying (cu->header.sect_off)
+ attr->set_unsigned ((to_underlying (cu_header->sect_off)
+ read_4_bytes (abfd, info_ptr)));
info_ptr += 4;
break;
case DW_FORM_ref8:
- attr->set_unsigned ((to_underlying (cu->header.sect_off)
+ attr->set_unsigned ((to_underlying (cu_header->sect_off)
+ read_8_bytes (abfd, info_ptr)));
info_ptr += 8;
break;
@@ -20503,7 +20503,7 @@ read_attribute_value (const struct die_reader_specs *reader,
info_ptr += 8;
break;
case DW_FORM_ref_udata:
- attr->set_unsigned ((to_underlying (cu->header.sect_off)
+ attr->set_unsigned ((to_underlying (cu_header->sect_off)
+ read_unsigned_leb128 (abfd, info_ptr,
&bytes_read)));
info_ptr += bytes_read;
--
2.26.2
reply other threads:[~2021-03-14 18:03 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=20210314180314.380565-1-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@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).