From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24591 invoked by alias); 26 Feb 2014 18:58:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 24582 invoked by uid 89); 26 Feb 2014 18:58:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 26 Feb 2014 18:58:16 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2C4D311665A for ; Wed, 26 Feb 2014 13:58:15 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id h+8sTwlCvNB2 for ; Wed, 26 Feb 2014 13:58:15 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id EDCBD116656 for ; Wed, 26 Feb 2014 13:58:14 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id E3F32E04D4; Wed, 26 Feb 2014 10:58:13 -0800 (PST) Date: Wed, 26 Feb 2014 18:58:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [RFA/DWARF] Set enum type "flag_enum" and "unsigned" flags at type creation. Message-ID: <20140226185813.GH4348@adacore.com> References: <1390796357-3739-1-git-send-email-brobecker@adacore.com> <1392820455.21975.235.camel@bordewijk.wildebeest.org> <1392823115.21975.238.camel@bordewijk.wildebeest.org> <20140226183157.GF4348@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="JwB53PgKC5A7+0Ej" Content-Disposition: inline In-Reply-To: <20140226183157.GF4348@adacore.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-02/txt/msg00792.txt.bz2 --JwB53PgKC5A7+0Ej Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 174 > I'll add a comment in the code... Attached is the patch adding the comment... gdb/ChangeLog: * dwarf2read.c (read_subrange_type): Add comment. Thanks, -- Joel --JwB53PgKC5A7+0Ej Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Add-comment-in-dwarf2read.c-read_subrange_type.patch" Content-length: 1811 >From dbb9c2b1f231262ece36790241fe1fc3902cf03d Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 26 Feb 2014 10:53:05 -0800 Subject: [PATCH] Add comment in dwarf2read.c::read_subrange_type This comment explains why we sometimes sign-extend the range type bounds when we normally shouldn't have to. gdb/ChangeLog: * dwarf2read.c (read_subrange_type): Add comment. --- gdb/ChangeLog | 4 ++++ gdb/dwarf2read.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8f2f0dc..49d8113 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2014-02-27 Joel Brobecker + * dwarf2read.c (read_subrange_type): Add comment. + +2014-02-27 Joel Brobecker + * dwarf2read.c (update_enumeration_type_from_children): New function, mostly extracted from process_structure_scope. (read_enumeration_type): Call update_enumeration_type_from_children. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 00bba47..52208d6 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -14522,6 +14522,13 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) } } + /* Normally, the DWARF producers are expected to use a signed + constant form (Eg. DW_FORM_sdata) to express negative bounds. + But this is unfortunately not always the case, as witnessed + with GCC, for instance, where the ambiguous DW_FORM_dataN form + is used instead. To work around that ambiguity, we treat + the bounds as signed, and thus sign-extend their values, when + the base type is signed. */ negative_mask = (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) -- 1.8.3.2 --JwB53PgKC5A7+0Ej--