From patchwork Thu Aug 24 12:57:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 22344 Received: (qmail 130142 invoked by alias); 24 Aug 2017 12:57:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 130131 invoked by uid 89); 24 Aug 2017 12:57:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 24 Aug 2017 12:57:05 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 75C635F7B1 for ; Thu, 24 Aug 2017 12:57:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 75C635F7B1 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jan.kratochvil@redhat.com Received: from host1.jankratochvil.net (ovpn-117-146.ams2.redhat.com [10.36.117.146]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B45C57F1D9; Thu, 24 Aug 2017 12:57:03 +0000 (UTC) Date: Thu, 24 Aug 2017 14:57:00 +0200 From: Jan Kratochvil To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: [patchv2+8.0] DWARF-5 Fix DW_FORM_implicit_const Message-ID: <20170824125700.GA7891@host1.jankratochvil.net> References: <20170622203308.GA23353@host1.jankratochvil.net> <2f19870d-0c08-193f-1971-b58333039f40@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2f19870d-0c08-193f-1971-b58333039f40@redhat.com> User-Agent: Mutt/1.8.3 (2017-05-23) On Thu, 24 Aug 2017 01:08:01 +0200, Pedro Alves wrote: > Wouldn't that be more direct and to the point? If I'm imagining > that version of the patch correctly, that'd seem like a > more obvious choice to me. The proposed version looks like is > frobbing the form so that DW_FORM_sdata so that those two other > functions end up doing the right thing as side effect. Right? > Is there some advantage to doing it the sdata way? It kind of feels > like a hack, but maybe I'm missing something. Is this patch OK? Regression tested on fedora-rawhide {x86_64,x86_64-m32,i686}. Thanks, Jan gdb/ChangeLog 2017-08-24 Jan Kratochvil * dwarf2read.c (dwarf2_const_value_attr, dump_die_shallow) (dwarf2_get_attr_constant_value, dwarf2_fetch_constant_bytes) (skip_form_bytes, attr_form_is_constant): Handle DW_FORM_implicit_const. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 38228500ab..d4dd01b8b3 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -19499,6 +19499,7 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type, break; case DW_FORM_sdata: + case DW_FORM_implicit_const: *value = DW_SND (attr); break; @@ -20492,6 +20493,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) fprintf_unfiltered (f, "unexpected attribute form: DW_FORM_indirect"); break; + case DW_FORM_implicit_const: + fprintf_unfiltered (f, "constant: %s", + plongest (DW_SND (&die->attrs[i]))); + break; default: fprintf_unfiltered (f, "unsupported attribute form: %d.", die->attrs[i].form); @@ -20583,7 +20588,7 @@ dwarf2_get_ref_die_offset (const struct attribute *attr) static LONGEST dwarf2_get_attr_constant_value (const struct attribute *attr, int default_value) { - if (attr->form == DW_FORM_sdata) + if (attr->form == DW_FORM_sdata || attr->form == DW_FORM_implicit_const) return DW_SND (attr); else if (attr->form == DW_FORM_udata || attr->form == DW_FORM_data1 @@ -20918,6 +20923,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off, break; case DW_FORM_sdata: + case DW_FORM_implicit_const: type = die_type (die, cu); result = write_constant_as_bytes (obstack, byte_order, type, DW_SND (attr), len); @@ -21854,6 +21860,9 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end, } break; + case DW_FORM_implicit_const: + break; + default: { complain: @@ -22495,6 +22504,7 @@ attr_form_is_constant (const struct attribute *attr) case DW_FORM_data2: case DW_FORM_data4: case DW_FORM_data8: + case DW_FORM_implicit_const: return 1; default: return 0;