From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 4CA063858002 for ; Thu, 18 Mar 2021 14:12:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4CA063858002 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6E228AD20; Thu, 18 Mar 2021 14:12:48 +0000 (UTC) Subject: Re: [PATCH 1/2] Remove Irix 6 workaround from DWARF abbrev reader To: Tom Tromey , gdb-patches@sourceware.org References: <20210306170142.1960263-1-tom@tromey.com> <20210306170142.1960263-2-tom@tromey.com> From: Tom de Vries Message-ID: Date: Thu, 18 Mar 2021 15:12:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210306170142.1960263-2-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 14:12:53 -0000 On 3/6/21 6:01 PM, Tom Tromey wrote: > 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. > This caused the following regression: ... FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc ... Filed at https://sourceware.org/bugzilla/show_bug.cgi?id=27604 . Thanks, - Tom > gdb/ChangeLog > 2021-03-06 Tom Tromey > > * 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; >