From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 1/2] Remove Irix 6 workaround from DWARF abbrev reader
Date: Sat, 6 Mar 2021 10:01:41 -0700 [thread overview]
Message-ID: <20210306170142.1960263-2-tom@tromey.com> (raw)
In-Reply-To: <20210306170142.1960263-1-tom@tromey.com>
abbrev_table::read has a workaround for Irix 6. The last release of
Irix was in 2006, and (according to Wikipedia) hardware produced after
2007 cannot run Irix. I think this workaround can safely be retired.
gdb/ChangeLog
2021-03-06 Tom Tromey <tom@tromey.com>
* dwarf2/abbrev.c (abbrev_table::read): Remove Irix 6 workaround.
---
gdb/ChangeLog | 4 ++++
gdb/dwarf2/abbrev.c | 28 +++++++++-------------------
2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c
index 9ece708a1ac..a8bdf7182de 100644
--- a/gdb/dwarf2/abbrev.c
+++ b/gdb/dwarf2/abbrev.c
@@ -84,7 +84,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
bfd *abfd = section->get_bfd_owner ();
const gdb_byte *abbrev_ptr;
struct abbrev_info *cur_abbrev;
- unsigned int abbrev_number, bytes_read;
abbrev_table_up abbrev_table (new struct abbrev_table (sect_off));
struct obstack *obstack = &abbrev_table->m_abbrev_obstack;
@@ -92,12 +91,17 @@ abbrev_table::read (struct dwarf2_section_info *section,
/* Caller must ensure this. */
gdb_assert (section->readin);
abbrev_ptr = section->buffer + to_underlying (sect_off);
- abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- /* Loop until we reach an abbrev number of 0. */
- while (abbrev_number)
+ while (true)
{
+ unsigned int bytes_read;
+ /* Loop until we reach an abbrev number of 0. */
+ unsigned int abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr,
+ &bytes_read);
+ if (abbrev_number == 0)
+ break;
+ abbrev_ptr += bytes_read;
+
/* Start without any attrs. */
obstack_blank (obstack, offsetof (abbrev_info, attrs));
cur_abbrev = (struct abbrev_info *) obstack_base (obstack);
@@ -144,20 +148,6 @@ abbrev_table::read (struct dwarf2_section_info *section,
cur_abbrev = (struct abbrev_info *) obstack_finish (obstack);
cur_abbrev->num_attrs = num_attrs;
abbrev_table->add_abbrev (cur_abbrev);
-
- /* Get next abbreviation.
- Under Irix6 the abbreviations for a compilation unit are not
- always properly terminated with an abbrev number of 0.
- Exit loop if we encounter an abbreviation which we have
- already read (which means we are about to read the abbreviations
- for the next compile unit) or if the end of the abbreviation
- table is reached. */
- if ((unsigned int) (abbrev_ptr - section->buffer) >= section->size)
- break;
- abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
- abbrev_ptr += bytes_read;
- if (abbrev_table->lookup_abbrev (abbrev_number) != NULL)
- break;
}
return abbrev_table;
--
2.26.2
next prev parent reply other threads:[~2021-03-06 17:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 17:01 [PATCH 0/2] Two minor abbrev improvements Tom Tromey
2021-03-06 17:01 ` Tom Tromey [this message]
2021-03-15 0:25 ` [PATCH 1/2] Remove Irix 6 workaround from DWARF abbrev reader Maciej W. Rozycki
2021-03-18 14:12 ` Tom de Vries
2021-03-06 17:01 ` [PATCH 2/2] Constify abbrev_table::lookup_abbrev Tom Tromey
2021-03-08 4:00 ` [PATCH 0/2] Two minor abbrev improvements Simon Marchi
2021-03-13 18:04 ` Tom Tromey
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=20210306170142.1960263-2-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).