From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KG7WOBx8zl9ETQAAWB0awg (envelope-from ) for ; Mon, 07 Dec 2020 14:01:48 -0500 Received: by simark.ca (Postfix, from userid 112) id E65A61F0BA; Mon, 7 Dec 2020 14:01:48 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EC0231EFBB for ; Mon, 7 Dec 2020 14:01:42 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 424F63953C01; Mon, 7 Dec 2020 19:01:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 424F63953C01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1607367702; bh=URO+7hXRrBct9PmolsKl/ek97LZbcKgAtcAiTivR9bE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=TNGm9cXKIFCV+yhTXA2yy92hNdNX3YfnhF4xjyBlWoGBwybDawMzikRPI1WRwKSbh OtSmmRcj3xcl1M7sKwCtQ/aK+Jh/Bg9xkA9L0fv12NXViRIuq+mylFhRwexCmcbfFm lJyf0ZP3wvpPEgXEE0WIem8zKYW4HzlnTDHwhi1Q= Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2056.outbound.protection.outlook.com [40.107.244.56]) by sourceware.org (Postfix) with ESMTPS id 1B334393D02B for ; Mon, 7 Dec 2020 19:01:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1B334393D02B ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rvwwvt+seEK0x4yFqcQB3R3e8jLnLJT45Cl6zueh2+FKARI24MBqVFETSU604V+hlgaNUg/hySE/E6C530IDXchKQT9WaZtMTZjYxPQIoM45bqwVcAeKGDbGXiv75HPqVM1Nz0dakJ7d0068eXvJO4HoyBipc9QrJeTRY7DLvDbr+oypUgys+mAHGJ/WD+XHHqe/PyWkjpw7KC8xBbBI5f2ykQf8gyVkrMcvaQHoxpfxLSvarKBvLHKARYqN2ljY9amzjdk+DQ2gdl1UgZkTCD4n1YlqVtVgRZbuIz9y0Z2BuMMQQBLrJEFgz48c1SGRkTz1ruwZbMRUrF2ThAGoKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=URO+7hXRrBct9PmolsKl/ek97LZbcKgAtcAiTivR9bE=; b=Mor2SuwIp0ModV7+pefG72E0dNGOde9Vw/rB7/bUvjzrlupZwWRIpyNZ7nF+bzzkbV8/quavWNmIZjd5EUFNv3bUFrAwsJdY3YvhdvK9wyBqequsypM+SmdQ/iycc2+XAJ/YU0FCVpvVThULuSqSUYxycnOkr3g9+5YLcvmLmmUoI8BlDQPB+emQBhgcT/s2zmpYLzIy2duUn2Arc6+q4MF4zLfwPIWg8jlNUBKTtVZfjm7g09RDtDrkgJW6GIfk2CYDCAh7gy0yWyvaXKkOkWI/KWeaYEyAnlzo8JzJLhPMaVCNA2WhMWpeWnKv1i+4wrWJFYdvs6EZG3A2ZXLM9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none Received: from DM6PR12MB2762.namprd12.prod.outlook.com (2603:10b6:5:45::15) by DM6PR12MB4561.namprd12.prod.outlook.com (2603:10b6:5:2ac::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.18; Mon, 7 Dec 2020 19:01:30 +0000 Received: from DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::6841:61df:984b:b3c]) by DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::6841:61df:984b:b3c%3]) with mapi id 15.20.3632.021; Mon, 7 Dec 2020 19:01:30 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 23/30] Rename and update the piece_closure structure Date: Mon, 7 Dec 2020 19:00:24 +0000 Message-Id: <20201207190031.13341-24-Zoran.Zaric@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201207190031.13341-1-Zoran.Zaric@amd.com> References: <20201207190031.13341-1-Zoran.Zaric@amd.com> Content-Type: text/plain X-Originating-IP: [2a00:23c7:5a85:6801:5c7:2db6:d2c2:ae4e] X-ClientProxiedBy: AM4PR0101CA0053.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::21) To DM6PR12MB2762.namprd12.prod.outlook.com (2603:10b6:5:45::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a00:23c7:5a85:6801:5c7:2db6:d2c2:ae4e) by AM4PR0101CA0053.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Mon, 7 Dec 2020 19:01:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 15e1a648-79ad-4e2c-291d-08d89ae28200 X-MS-TrafficTypeDiagnostic: DM6PR12MB4561: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:530; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 82tMih0G2Shey1huGNULLUzpeic3Jyj0qLmMCf69jVvzvkY1Tk4++pcHODXzurTUPgIFTCEBWcMT9Zk/Uqmb6+kWWr1DuSLxqE0E3fnF+AYPt9Tdip6JR3pPhZYkUB+4Hf4OSNtMUuLpAevZLaC/T8TV2eqM4gjRlY9dMzgocd6dnjsrQcuFojiHd5niq00pZpVKVxFozice95gnC4lA26J4G94CuiCjFaOXWH7qmV0itg8Wbm9s3ok6S5T00kOPglSEQcZK0MLtyDCwLZE3WXj1l6EEpMnBSDFFBsmkqYFSTE+PCSTD6KtPpzp9utjzQxGAJQYT28/YmhhL6hNsg/dJlWxYCWM15gWPOEXNa8WVeJlflhVnDijhuUbjIVrr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB2762.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(39860400002)(366004)(136003)(396003)(1076003)(30864003)(83380400001)(86362001)(6506007)(4326008)(69590400008)(52116002)(36756003)(2906002)(6512007)(8676002)(6486002)(16526019)(2616005)(66946007)(66476007)(66556008)(6916009)(5660300002)(186003)(8936002)(478600001)(6666004)(316002)(15650500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?ksgZB95TFvK4cglfXKtBGU55DFOqKdv9pq4Mu4CPgJoEVLYPM8WyHcpJAiFB?= =?us-ascii?Q?72kfHRm+yAYYBYqhohzG4LlWoY0D1yDxky5zHGQlDPgqtTrsjS9qCqjjb5yl?= =?us-ascii?Q?RZPF47fonM11CCz9kXTOrxR/pjpCvF1dv9gT9H5Ebrkw1LDEltHZuDNbQAM4?= =?us-ascii?Q?UAc3hg+180iL6Rn8v4dj8jEKRvghWhYLFX/zoAS66qaIVqEWbLgAqBgVgsFI?= =?us-ascii?Q?LKwFYeypKOws8eUD84qthBnVM+oq939KyucmonHav+l6o4opIbOFl9gnZCGk?= =?us-ascii?Q?qtuERgdlTGKFvz4CU/eXamJXswqR4/9npHkkJVkJm6xKIJ1UohYq4D9eF6Ed?= =?us-ascii?Q?VKycIDu40eUAWAacDaSgPJDXikdttqwN0E05tVZd+6oSe9mvfgJsyJaGlozw?= =?us-ascii?Q?qYsXkWXav70YyhjBMJ7JNJS04rxMvR9sKhgq77r3RtVsW5bPcSuERV+pospk?= =?us-ascii?Q?+O4IqOZiSNnVvF5vzPy8928MKGe4NbBIkiVs/iYB0J0KnL9ROZNAviXl31M3?= =?us-ascii?Q?/R6Thutc/EZNxZoG2b6yjmHF1w70Yh+kDcIduDkhBNq03c/AzA8xpLfNBy5d?= =?us-ascii?Q?xg1e1DsIGUMIxDFKEsdbfsLBI6UsBjjYiB5wOf9FJ7gDYB2S2h/SlroN46Vi?= =?us-ascii?Q?hPUKvPtBkBRiKraddiO+hPXzx+Ts4R28QEn0hZhHKYWilgB0XqDqmzRFA2Lt?= =?us-ascii?Q?eRTg/9bOcqE6ETj/1X/gLRlROVJT+z6vOeduwl63alBum0CeuRE4xmslo2bX?= =?us-ascii?Q?uudtrpLwPXtbJgVV/hjUiwfNoc4xJkDR3XVLiQet3QOJPCEn11XDEME0kLQH?= =?us-ascii?Q?3j8T0gD+fA4B9oRGAIK6D3ZPD00gEvlsuRc1pFSkUpKfECGaxaVMv9Bq+u20?= =?us-ascii?Q?Z+pnOf4v+0vUdY3W5sXVecF7yHeCLwln2uGplVHiGBlkylj+6K/vkkAafBhC?= =?us-ascii?Q?eUX8ubEYs0mohbasoDJsrE5I/eLlrXgBwWd1X2LEkYW+IHW/r29zPyok+gxX?= =?us-ascii?Q?Sv1eg84f0KpTHePivBBFZl9FhJG8iQ/wH438PpxBfAFy3ORnPv7t6C/ztEBv?= =?us-ascii?Q?WNhl6h91?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB2762.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2020 19:01:30.5840 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: 15e1a648-79ad-4e2c-291d-08d89ae28200 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6cNEeB/6iFaEDgMdifm+BQW+88kP6ll+8gT2E126fBxnEnVXf122r5UWTUQ++UYMw1e2MFTPIhnnTbdHGCwZKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4561 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: , From: Zoran Zaric via Gdb-patches Reply-To: Zoran Zaric Cc: Zoran Zaric Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Class that describes a computed_lval closure needs to be update to fit better with the new dwarf_entry set of classes. This also means that a pieced_value_funcs interface with that closure, needs to be renamed and updated accordingly. Considering that a closure is designed to describe a computed location description, it makes sense to rename piece_closure to a computed_closure. gdb/ChangeLog: * dwarf2/expr.c (struct piece_closure): Change to computed_closure class. (allocate_piece_closure): Remove function. (rw_pieced_value): Rename to rw_closure_value and change to use computed_closure class. (read_pieced_value): Rename to read_closure_value and change to use computed_closure class. (write_pieced_value): Rename to write_closure_value and change to use computed_closure class. (check_pieced_synthetic_pointer): Rename to check_synthetic_pointer and change to use computed_closure class. (indirect_pieced_value): Rename to indirect_closure_value and change to use computed_closure class. (coerce_pieced_ref): Rename to coerce_closure_ref and change to use computed_closure class. (copy_pieced_value_closure): Rename to copy_value_closure and change to use computed_closure class. (free_pieced_value_closure): Rename to free_value_closure and change to use computed_closure class. (dwarf_expr_context::gdb_value_to_dwarf_entry): Change to use computed_closure class. (dwarf_expr_context::dwarf_entry_to_gdb_value): Change to use computed_closure class. --- gdb/dwarf2/expr.c | 206 +++++++++++++++++++++++----------------------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 9ed0ad8baf..a259f5d5d5 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -1351,77 +1351,68 @@ dwarf_entry_factory::value_cast_op (const dwarf_value *arg, struct type *type) return create_value (value_contents_raw (result), type); } -struct piece_closure +/* Closure class that encapsulates a location description and + a context in which that description is created. Used for + lval_computed value abstraction. */ +class computed_closure : public refcounted_object { - /* Reference count. */ - int refc = 0; - - /* The objfile from which this closure's expression came. */ - dwarf2_per_objfile *per_objfile = nullptr; - - /* The CU from which this closure's expression came. */ - struct dwarf2_per_cu_data *per_cu = NULL; +public: + computed_closure (dwarf_entry *entry, struct frame_id frame_id) : + m_entry (entry), m_frame_id (frame_id) + {entry->incref ();} - /* Location description of this variable. */ - dwarf_location *location; + virtual ~computed_closure () + { + m_entry->decref (); - /* Frame ID of frame to which a register value is relative, used - only by DWARF_VALUE_REGISTER. */ - struct frame_id frame_id; -}; + if (m_entry->refcount () == 0) + delete m_entry; + } -/* Allocate a closure for a value formed from separately-described - PIECES. */ + dwarf_entry *get_entry () const + { + return m_entry; + } -static struct piece_closure * -allocate_piece_closure (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile, - dwarf_location *location, - struct frame_info *frame) -{ - struct piece_closure *c = new piece_closure; + struct frame_id get_frame_id () const + { + return m_frame_id; + } - c->refc = 1; - /* We must capture this here due to sharing of DWARF state. */ - c->per_objfile = per_objfile; - c->per_cu = per_cu; - if (frame == NULL) - c->frame_id = null_frame_id; - else - c->frame_id = get_frame_id (frame); +private: + /* Entry that this class encloses. */ + dwarf_entry *m_entry; - location->incref (); - c->location = location; - return c; -} + /* Frame ID context of the closure. */ + struct frame_id m_frame_id; +}; -/* Read or write a pieced value V. If FROM != NULL, operate in "write - mode": copy FROM into the pieces comprising V. If FROM == NULL, +/* Read or write a closure value V. If FROM != NULL, operate in "write + mode": copy FROM into the closure comprising V. If FROM == NULL, operate in "read mode": fetch the contents of the (lazy) value V by - composing it from its pieces. */ + composing it from its closure. */ static void -rw_pieced_value (struct value *v, struct value *from) +rw_closure_value (struct value *v, struct value *from) { LONGEST bit_offset = 0, max_bit_offset; - struct piece_closure *closure - = (struct piece_closure *) value_computed_closure (v); + computed_closure *closure = ((computed_closure*) value_computed_closure (v)); bool big_endian = type_byte_order (value_type (v)) == BFD_ENDIAN_BIG; - dwarf_entry *entry = closure->location; + dwarf_entry *entry = closure->get_entry (); /* Only expect implicit pointer and composite location description here. */ if (entry == nullptr || (dynamic_cast (entry) == nullptr - && dynamic_cast (entry) == nullptr)) + && dynamic_cast (entry) == nullptr)) internal_error (__FILE__, __LINE__, _("invalid location type")); if (from == NULL) { if (value_type (v) != value_enclosing_type (v)) - internal_error (__FILE__, __LINE__, - _("Should not be able to create a lazy value with " - "an enclosing type")); + internal_error (__FILE__, __LINE__, + _("Should not be able to create a lazy value with " + "an enclosing type")); } ULONGEST bits_to_skip = HOST_CHAR_BIT * value_offset (v); @@ -1454,7 +1445,7 @@ rw_pieced_value (struct value *v, struct value *from) return; } - struct frame_info *frame = frame_find_by_id (closure->frame_id); + struct frame_info *frame = frame_find_by_id (closure->get_frame_id ()); dwarf_composite *composite_entry = dynamic_cast (entry); @@ -1524,15 +1515,15 @@ rw_pieced_value (struct value *v, struct value *from) } static void -read_pieced_value (struct value *v) +read_closure_value (struct value *v) { - rw_pieced_value (v, NULL); + rw_closure_value (v, NULL); } static void -write_pieced_value (struct value *to, struct value *from) +write_closure_value (struct value *to, struct value *from) { - rw_pieced_value (to, from); + rw_closure_value (to, from); } /* Check if a given location contains an implicit pointer @@ -1592,17 +1583,18 @@ check_synthetic_pointer_location (const dwarf_location *location, a synthetic pointer. */ static int -check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, - int bit_length) +check_synthetic_pointer (const struct value *value, LONGEST bit_offset, + int bit_length) { LONGEST total_bit_offset = bit_offset + HOST_CHAR_BIT * value_offset (value); if (value_bitsize (value)) total_bit_offset += value_bitpos (value); - struct piece_closure *closure - = (struct piece_closure *) value_computed_closure (value); - dwarf_location *location = closure->location; + computed_closure *closure + = (computed_closure *) value_computed_closure (value); + auto location + = dynamic_cast (closure->get_entry ()); if (location == nullptr) return 0; @@ -1680,10 +1672,10 @@ indirect_from_location (const dwarf_location *location, pointer. This handles the synthetic pointer case when needed. */ static struct value * -indirect_pieced_value (struct value *value) +indirect_closure_value (struct value *value) { - struct piece_closure *closure - = (struct piece_closure *) value_computed_closure (value); + computed_closure *closure + = (computed_closure *) value_computed_closure (value); struct type *type = check_typedef (value_type (value)); if (type->code () != TYPE_CODE_PTR) @@ -1695,7 +1687,8 @@ indirect_pieced_value (struct value *value) if (value_bitsize (value)) bit_offset += value_bitpos (value); - dwarf_location *location = closure->location; + auto location + = dynamic_cast (closure->get_entry ()); /* Only location descriptions are meaningful here. */ if (location == nullptr) @@ -1726,20 +1719,20 @@ indirect_pieced_value (struct value *value) references. */ static struct value * -coerce_pieced_ref (const struct value *value) +coerce_closure_ref (const struct value *value) { struct type *type = check_typedef (value_type (value)); if (value_bits_synthetic_pointer (value, value_embedded_offset (value), TARGET_CHAR_BIT * TYPE_LENGTH (type))) { - struct piece_closure *closure - = (struct piece_closure *) value_computed_closure (value); + computed_closure *closure + = (computed_closure *) value_computed_closure (value); struct frame_info *frame = get_selected_frame (_("No frame selected.")); auto pointer_entry - = dynamic_cast (closure->location); + = dynamic_cast (closure->get_entry ()); /* Only implicit pointer location description is meaningful here. */ if (pointer_entry == nullptr) @@ -1747,8 +1740,8 @@ coerce_pieced_ref (const struct value *value) return indirect_synthetic_pointer (pointer_entry->get_die_offset (), pointer_entry->get_offset (), - closure->per_cu, - closure->per_objfile, + pointer_entry->get_per_cu (), + pointer_entry->get_per_objfile (), frame, type); } else @@ -1759,38 +1752,41 @@ coerce_pieced_ref (const struct value *value) } static void * -copy_pieced_value_closure (const struct value *v) +copy_value_closure (const struct value *v) { - struct piece_closure *c - = (struct piece_closure *) value_computed_closure (v); + computed_closure *closure = ((computed_closure*) value_computed_closure (v)); - ++c->refc; - return c; + if (closure == nullptr) + internal_error (__FILE__, __LINE__, _("invalid closure type")); + + closure->incref (); + return closure; } static void -free_pieced_value_closure (struct value *v) +free_value_closure (struct value *v) { - struct piece_closure *c - = (struct piece_closure *) value_computed_closure (v); + computed_closure *closure = ((computed_closure*) value_computed_closure (v)); - --c->refc; - if (c->refc == 0) - { - c->location->decref (); - delete c; - } + if (closure == nullptr) + internal_error (__FILE__, __LINE__, _("invalid closure type")); + + closure->decref (); + + if (closure->refcount () == 0) + delete closure; } -/* Functions for accessing a variable described by DW_OP_piece. */ -static const struct lval_funcs pieced_value_funcs = { - read_pieced_value, - write_pieced_value, - indirect_pieced_value, - coerce_pieced_ref, - check_pieced_synthetic_pointer, - copy_pieced_value_closure, - free_pieced_value_closure +/* Functions for accessing a variable described by DW_OP_piece, + DW_OP_bit_piece or DW_OP_implicit_pointer. */ +static const struct lval_funcs closure_value_funcs = { + read_closure_value, + write_closure_value, + indirect_closure_value, + coerce_closure_ref, + check_synthetic_pointer, + copy_value_closure, + free_value_closure }; /* Given context CTX, section offset SECT_OFF, and compilation unit @@ -2331,9 +2327,9 @@ dwarf_expr_context::gdb_value_to_dwarf_entry (struct value *value) { /* Dwarf entry is enclosed by the closure anyway so we just need to unwrap it here. */ - struct piece_closure *closure - = (struct piece_closure *) value_computed_closure (value); - auto location = dynamic_cast (closure->location); + computed_closure *closure + = ((computed_closure *) value_computed_closure (value)); + auto location = dynamic_cast (closure->get_entry ()); if (location == nullptr) internal_error (__FILE__, __LINE__, _("invalid closure type")); @@ -2425,15 +2421,19 @@ dwarf_expr_context::dwarf_entry_to_gdb_value (dwarf_entry *entry, (void *)(implicit_entry->get_contents () + subobj_offset), subtype_len); } - else if (auto implicit_pointer_entry - = dynamic_cast (entry)) + else if (dynamic_cast (entry) != nullptr) { - struct piece_closure *closure - = allocate_piece_closure (this->per_cu, this->per_objfile, - implicit_pointer_entry, this->frame); + /* Complain if the expression is larger than the size of the + outer type. */ + if (this->addr_size > HOST_CHAR_BIT * TYPE_LENGTH (type)) + invalid_synthetic_pointer (); + + computed_closure *closure + = new computed_closure (entry, get_frame_id (frame)); + closure->incref (); retval - = allocate_computed_value (subobj_type, &pieced_value_funcs, closure); + = allocate_computed_value (subobj_type, &closure_value_funcs, closure); set_value_offset (retval, subobj_offset); } else if (auto composite_entry = dynamic_cast (entry)) @@ -2449,12 +2449,12 @@ dwarf_expr_context::dwarf_entry_to_gdb_value (dwarf_entry *entry, if (bit_size > HOST_CHAR_BIT * TYPE_LENGTH (type)) invalid_synthetic_pointer (); - struct piece_closure *closure - = allocate_piece_closure (this->per_cu, this->per_objfile, - composite_entry, this->frame); + computed_closure *closure + = new computed_closure (entry, get_frame_id (frame)); + closure->incref (); retval - = allocate_computed_value (subobj_type, &pieced_value_funcs, closure); + = allocate_computed_value (subobj_type, &closure_value_funcs, closure); set_value_offset (retval, subobj_offset); } -- 2.17.1