From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4Pf5BQp8zl+QTQAAWB0awg (envelope-from ) for ; Mon, 07 Dec 2020 14:01:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 122FB1F071; Mon, 7 Dec 2020 14:01:30 -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 19EE71EF4B for ; Mon, 7 Dec 2020 14:01:27 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B1F5394D8B1; Mon, 7 Dec 2020 19:01:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B1F5394D8B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1607367686; bh=1SHtEVlPtjG04tIkHAPr7dsc8wOd/IG0q8xeRrGwuLg=; 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=Gc3RWNzzSHIONq6dJRfb/i1JSAQVl/NeYl9CK4LCC14wWpu2wDVxxzy7iLjsPg71l c/xfp8nqEY+KcpLy1a5ZdqtIfdQkA/AN94p8Tl+t+TFPkTJlrl8tFUWZBWFlSaDBC8 DB3r+r+e8i4KRnSEeFOzankUxZ1bfrVpH/cjdPHk= 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 026C9394D8B1 for ; Mon, 7 Dec 2020 19:01:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 026C9394D8B1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mBOs99DkI+8ycgbXEB3GrSihwNl7yuO4qD648CJaN4CDiHMK1aFUhOvbZuZhM+u2scldrd3UsEqDVzQfqTXXc0giKRhjsi0whY4mIujt3BTTltM7iTnLZ7Vv9C2ZSqhgk9hV5X4ednn0t4JuppF7hG8MV0N9kT9SEMU3CyZJDt3CHwKDCbefHxG/4q+M326CxRe/gZHYJVEuOAsp4n2kssqjoiMKZxW0OoOJaXSxHpO2zupiek+gDYt5tGTzvZerKbihAnn5yAsMxENvhibZqCavU52W9AI9guGiTEqc+1d3KtHYC2T6DAI/GrXCS6lqhbJWdEhzc+6R5ynpqIFwlg== 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=1SHtEVlPtjG04tIkHAPr7dsc8wOd/IG0q8xeRrGwuLg=; b=OBGzNlMLV+esEWbkKawNMVm0bEjGrpWBxxAX+n25higvlQ/1HLbo8UdUm50LdK/mXZc8lZ5iNqpoKG5RVQrGLl2ckoa54QxhJS2n1emea1OYTCqMUyBgu9wxrVQqTeML+W/pO1EN7Du2XWinrlg6kLaKYqpdPGk4EYcUeac1+llaWMBvmtWCI6lw62/BHh2HbBnwtg1YtXhpqdzFf1L6+Xq3WYL8nMUS6tIPzrfNZb4JIY3h2I7TQLH4b7mxf3YmU4dyXR/z7mrHW7QP4gxdcE5IArYYnANhSIPfz/AVgWKN/uLxjaLvqBAe/1iFX+C1zD1nVQt9v9Qrwx79m2S42Q== 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:10 +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:10 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 14/30] Simplify dwarf_expr_context class interface Date: Mon, 7 Dec 2020 19:00:15 +0000 Message-Id: <20201207190031.13341-15-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; charset=UTF-8 Content-Transfer-Encoding: 8bit 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:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a09832ea-0f8a-4c95-da6c-08d89ae275e8 X-MS-TrafficTypeDiagnostic: DM6PR12MB4561: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 93qE4doeiIgTMCUiJ+Lj1oi78QT8aXe9s9ZkW5F6q/KzX0WOu9WC1p6yTp/IqlOkA470KdzZ50ZcdX5wtZ7NxZv/F6AIkRW60bbwsteT90hudLPb2oLCaQ9wsTiec4LfxASiQUwvIO1bbjgAFg390iueFwO/mB3AoYGKWczDGaSjvJy+sAwTTKcv32qau4fVCn8xhkN7Roe/8+/h/IBg74LbUB5Tj1hr6WZjBXbJakmZLBdDKVIHj8vg6po/zPGc1Ckoe0hsVFJ5fQGyoUnxmQOVOLQBX+fDGI/JkDYRIZVXENCLU1ktc3tmZMHN5j4hi/Wgs7jhiVFnQKi/wiRn5g== 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)(52116002)(36756003)(2906002)(6512007)(8676002)(6486002)(16526019)(2616005)(66946007)(66476007)(66556008)(6916009)(5660300002)(186003)(8936002)(478600001)(6666004)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?YS9GWUcwS1RCK0piSDJ6RE9QWm92L1ArcW5OTzljMUxvcHFoNy9SVklkOE9h?= =?utf-8?B?bnVGNlp4NGtmZVhFY25YVUlPQ2h6a3FBOGFEUERaQ3gyYWhSKzVCNG9ZSzFW?= =?utf-8?B?cUZCNzFzTGcxWHVHbUJpNDlMQURORUFFcXdkSk02clByZlp5cFkyMnVDY0VN?= =?utf-8?B?aUVwb0ZnaXRxTk9veVJ4eTZXWklmcWRtVEl3ZjBmY2VXdm5XQWRuREQxbjlY?= =?utf-8?B?NUd0Yy9LeW9GYndUZ0dRYjFORXpsT2VTaGtNSWZCQjJyVW9HWHBrN1NjQWpz?= =?utf-8?B?ZmRDKy8wYXo1MDdQcGJVa1J3dWtkcDVqd3R6YjIzM2hhelVrQlNqWjdvZzJ2?= =?utf-8?B?SE5yekl3dlhuYWtuUHVZR1ZhUkc2WDRaSFRSVmtNUkNQUlZvMk1YWXBJT2NS?= =?utf-8?B?QWcyRlhDTzZ6MnUvcXNFVDlXSTdleXFrNWFzRDdlbGVkZU5QSGF2aWNHN0Jq?= =?utf-8?B?d3FvWHJuWGFtR1pMQzdjZWRXcW04ei96OWt3SU9QUHU1RGdQY2Eya0tjS2kw?= =?utf-8?B?WWt4TU1vNDhCSDNQOHNZU21LZGRhVk16VzQ2RUQvbHMybDFwQXZ5QWpwQi95?= =?utf-8?B?OWRmVTlPdUtlekZvMEdNV0FQaVBCOXRLdUw4aWdLcjk2eXVHVVRzUElnNTIr?= =?utf-8?B?RGN1SVhnUU9ZVUZrakR6QVFVMFRPcEtFbjI4K3JvdDliMUxHTlhpSUNHUHRo?= =?utf-8?B?REc2bFcrZEsveFpoNmtTb3A1RVJYUGhsaFVZdkRmZFVNRTI1OGlMaFRIOE9h?= =?utf-8?B?VjBHYU1IYTFTOVpUcHFWRW1PQ0NldTljUkwwb0xjU1Z4YStLRlNXcFRPWTR3?= =?utf-8?B?VXVqRTRqUFI3RmlrM2ZWdzZtb0g1bjQzR2VIWkZHajlRSTgxV2Y3QzBIbVU3?= =?utf-8?B?dkNZZEZ6ZkV3UTJzbTNlTC9jY3RNZzVYSmtmVER1bGdnQWttOTlQK2tBTWZq?= =?utf-8?B?Vy9leU41RFRwYUZhYkJmWHJRSFJwYlphVFVCRDhOWjF4SytwSFZuTUw1UWlz?= =?utf-8?B?cnlYTllrZTJMczNuSDhBWXl1Q3NDcElSR0FiUTlneExOQ1B6Tmg4MUNNdyt6?= =?utf-8?B?WFo4NmNZeHlEbnJ6S3BsYWFxeVR2bXA2VHJoMHZrQnR1aHVodXlyYXFla3N4?= =?utf-8?B?Q1ZTaXVIbURtYm1CZDBQc2FXU1BLTTd1TFI0S0huTUZNM0pjbEJEVTlkTGVv?= =?utf-8?B?aTNXZmdoQWRRUlRRNnVpR3AwYzhoQjFlaE1zUTc1d3kxVzBSUHlzZ3FJdXJ1?= =?utf-8?B?Uk9aWUZRYUFzNlZYdzYyeFl6REZKYjdaRFZKY2dtRUNjbHNwQzhqSkY0dERB?= =?utf-8?B?S2p3ZUpGK1lRUTk0bFBUUTFKdGwzMUswWFFDb2ZNNWZiOFlxODdxd1ZFZHZC?= =?utf-8?B?MWxjSUQ1NXQ3WG9PNDk0dCtoNFBBcDRCaHhlL3NJV0IrMEc3SGhJWFI3V0dE?= =?utf-8?Q?rhjeUKpP?= 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:10.3406 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: a09832ea-0f8a-4c95-da6c-08d89ae275e8 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: A+yHOJQCy/ZBk9jZF5I9yNL4VidnXOEYPlGvgCUg2o3aHF+9Fxn9X88Ljybi/7QKo6MYkCUzlaIOkDldmB7g/A== 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" From: Zoran Zaric Idea of this patch is to get a clean and simple public interface for the dwarf_expr_context class, looking like: - constructor, - destructor, - push_address method and - eval_exp method. Where constructor should only ever require a target architecture information. This information is held in per object file (dwarf2_per_objfile) structure, so it makes sense to keep that structure as a constructor argument. It also makes sense to get the address size from that structure, but unfortunately that interface doesn’t exist at the moment, so the dwarf_expr_context class user needs to provide that information. The push_address method is used to push a CORE_ADDR as a value on top of the DWARF stack before the evaluation. This method can be later changed to push any struct value object on the stack. The eval_exp method is the method that evaluates a DWARF expression and provides the evaluation result, in a form of a single struct value object that describes a location. To do this, the method requires a context of the evaluation, as well as expected result type information. If the type information is not provided, the DWARF generic type will be used instead. gdb/ChangeLog: * dwarf2/expr.c (dwarf_expr_context::dwarf_expr_context): Add address size argument. (dwarf_expr_context::read_mem): Change to use property_addr_info structure. (dwarf_expr_context::eval_exp): New function. (dwarf_expr_context::execute_stack_op): Change to use property_addr_info structure. * dwarf2/expr.h (struct dwarf_expr_context): New eval_exp declaration. Change eval and fetch_result method to private. * dwarf2/frame.c (execute_stack_op): Change to call eval_exp method. * dwarf2/loc.c (dwarf2_evaluate_loc_desc_full): Change to call eval_exp method. (dwarf2_locexpr_baton_eval): Change to call eval_exp method. --- gdb/dwarf2/expr.c | 51 +++++++++++++++++++++++++++++++++++----------- gdb/dwarf2/expr.h | 44 +++++++++++++++++++++++++-------------- gdb/dwarf2/frame.c | 18 ++++------------ gdb/dwarf2/loc.c | 41 ++++++++++++------------------------- 4 files changed, 85 insertions(+), 69 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 7f8e8134a4..5e99a98e1e 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -693,9 +693,10 @@ dwarf_expr_context::address_type () const /* Create a new context for the expression evaluator. */ -dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile) -: gdbarch (NULL), - addr_size (0), +dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile, + int addr_size) +: gdbarch (per_objfile->objfile->arch ()), + addr_size (addr_size), ref_addr_size (0), recursion_depth (0), max_recursion_depth (0x100), @@ -706,7 +707,7 @@ dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile) per_objfile (per_objfile), frame (nullptr), per_cu (nullptr), - obj_address (0) + addr_info (nullptr) { } @@ -831,13 +832,17 @@ dwarf_expr_context::read_mem (gdb_byte *buf, CORE_ADDR addr, return; /* Prefer the passed-in memory, if it exists. */ - CORE_ADDR offset = addr - obj_address; + if (addr_info != nullptr) + { + CORE_ADDR offset = addr - addr_info->addr; - if (offset < data_view.size () && offset + length <= data_view.size ()) + if (offset < addr_info->valaddr.size () + && offset + length <= addr_info->valaddr.size ()) { - memcpy (buf, data_view.data (), length); + memcpy (buf, addr_info->valaddr.data (), length); return; } + } read_memory (addr, buf, length); } @@ -880,8 +885,8 @@ dwarf_expr_context::push_dwarf_reg_entry_value caller_frame); scoped_restore save_per_cu = make_scoped_restore (&this->per_cu, caller_per_cu); - scoped_restore save_obj_addr = make_scoped_restore (&this->obj_address, - (CORE_ADDR) 0); + scoped_restore save_addr_info = make_scoped_restore (&this->addr_info, + nullptr); scoped_restore save_per_objfile = make_scoped_restore (&this->per_objfile, caller_per_objfile); @@ -1049,6 +1054,28 @@ dwarf_expr_context::fetch_result (struct type *type, return retval; } +/* See expr.h. */ + +struct value * +dwarf_expr_context::eval_exp (const gdb_byte *addr, size_t len, + struct dwarf2_per_cu_data *per_cu, + struct frame_info *frame, + const struct property_addr_info *addr_info, + struct type *type, + struct type *subobj_type, + LONGEST subobj_offset) +{ + this->per_cu = per_cu; + this->frame = frame; + this->addr_info = addr_info; + + if (per_cu != nullptr) + this->ref_addr_size = per_cu->ref_addr_size (); + + eval (addr, len); + return fetch_result (type, subobj_type, subobj_offset); +} + /* Require that TYPE be an integral type; throw an exception if not. */ static void @@ -2319,11 +2346,11 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr, case DW_OP_push_object_address: /* Return the address of the object we are currently observing. */ - if (this->data_view.data () == nullptr - && this->obj_address == 0) + if (addr_info == nullptr) error (_("Location address is not set.")); - result_val = value_from_ulongest (address_type, this->obj_address); + result_val + = value_from_ulongest (address_type, this->addr_info->addr); break; default: diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index b7605ffd28..69a043da50 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -119,19 +119,30 @@ struct dwarf_stack_value its current state and its callbacks. */ struct dwarf_expr_context { - dwarf_expr_context (dwarf2_per_objfile *per_objfile); + /* We should ever only pass in the PER_OBJFILE, while the ADDR_SIZE + information should be retrievable from there. The PER_OBJFILE + contains a pointer to the PER_BFD information anyway and the + address size information must be the same for the whole BFD. */ + dwarf_expr_context (struct dwarf2_per_objfile *per_objfile, + int addr_size); virtual ~dwarf_expr_context () = default; void push_address (CORE_ADDR value, bool in_stack_memory); - void eval (const gdb_byte *addr, size_t len); - /* Fetch the result of the expression evaluation in a form of - a struct value, where TYPE, SUBOBJ_TYPE and SUBOBJ_OFFSET - describe the source level representation of that result. */ - struct value *fetch_result (struct type *type = nullptr, - struct type *subobj_type = nullptr, - LONGEST subobj_offset = 0); + /* Evaluate the expression at ADDR (LEN bytes long) in a given PER_CU + FRAME context. Where TYPE, SUBOBJ_TYPE and SUBOBJ_OFFSET describe + expected struct value representation of the evaluation result. + The ADDR_INFO property can be specified to override the range of + memory addresses with the passed in buffer. */ + struct value *eval_exp (const gdb_byte *addr, size_t len, + struct dwarf2_per_cu_data *per_cu, + struct frame_info *frame, + const struct property_addr_info *addr_info = nullptr, + struct type *type = nullptr, + struct type *subobj_type = nullptr, + LONGEST subobj_offset = 0); +private: /* The stack of values. */ std::vector stack; @@ -196,14 +207,10 @@ struct dwarf_expr_context /* Compilation unit used for the evaluation. */ struct dwarf2_per_cu_data *per_cu; - /* Object address used for the evaluation. */ - CORE_ADDR obj_address; - - /* The data that was passed in. */ - gdb::array_view data_view; - -private: + /* Property address info used for the evaluation. */ + const struct property_addr_info *addr_info; + void eval (const gdb_byte *addr, size_t len); struct type *address_type () const; void push (struct value *value, bool in_stack_memory); bool stack_empty_p () const; @@ -214,6 +221,13 @@ struct dwarf_expr_context CORE_ADDR fetch_address (int n); bool fetch_in_stack_memory (int n); + /* Fetch the result of the expression evaluation in a form of + a struct value, where TYPE, SUBOBJ_TYPE and SUBOBJ_OFFSET + describe the source level representation of that result. */ + struct value *fetch_result (struct type *type, + struct type *subobj_type, + LONGEST subobj_offset); + /* Return the location expression for the frame base attribute, in START and LENGTH. The result must be live until the current expression evaluation is complete. */ diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 039990dea3..228c48f387 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -228,26 +228,16 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size, struct frame_info *this_frame, CORE_ADDR initial, int initial_in_stack_memory, dwarf2_per_objfile *per_objfile) { - dwarf_expr_context ctx (per_objfile); + dwarf_expr_context ctx (per_objfile, addr_size); scoped_value_mark free_values; - ctx.frame = this_frame; - ctx.gdbarch = get_frame_arch (this_frame); - ctx.addr_size = addr_size; - ctx.ref_addr_size = -1; - ctx.push_address (initial, initial_in_stack_memory); - ctx.eval (exp, len); - - CORE_ADDR result; - struct value *result_val = ctx.fetch_result (); + struct value *result_val = ctx.eval_exp (exp, len, nullptr, this_frame); if (VALUE_LVAL (result_val) == lval_memory) - result = value_address (result_val); + return value_address (result_val); else - result = value_as_address (result_val); - - return result; + return value_as_address (result_val); } diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 90ab2077c6..fdf8385933 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -1430,8 +1430,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, struct type *subobj_type, LONGEST subobj_byte_offset) { - struct value *retval; - if (subobj_type == NULL) { subobj_type = type; @@ -1443,22 +1441,15 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, if (size == 0) return allocate_optimized_out_value (subobj_type); - dwarf_expr_context ctx (per_objfile); - ctx.frame = frame; - ctx.per_cu = per_cu; - ctx.obj_address = 0; + dwarf_expr_context ctx (per_objfile, per_cu->addr_size ()); + struct value *retval; scoped_value_mark free_values; - ctx.gdbarch = per_objfile->objfile->arch (); - ctx.addr_size = per_cu->addr_size (); - ctx.ref_addr_size = per_cu->ref_addr_size (); - try { - ctx.eval (data, size); - retval = ctx.fetch_result (type, subobj_type, - subobj_byte_offset); + retval = ctx.eval_exp (data, size, per_cu, frame, nullptr, type, + subobj_type, subobj_byte_offset); } catch (const gdb_exception_error &ex) { @@ -1528,30 +1519,24 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, return 0; dwarf2_per_objfile *per_objfile = dlbaton->per_objfile; - dwarf_expr_context ctx (per_objfile); + struct dwarf2_per_cu_data *per_cu = dlbaton->per_cu; + dwarf_expr_context ctx (per_objfile, per_cu->addr_size ()); struct value *result; scoped_value_mark free_values; - ctx.frame = frame; - ctx.per_cu = dlbaton->per_cu; - if (addr_stack != nullptr) + if (push_initial_value) { - ctx.obj_address = addr_stack->addr; - ctx.data_view = addr_stack->valaddr; + if (addr_stack != nullptr) + ctx.push_address (addr_stack->addr, false); + else + ctx.push_address (0, false); } - ctx.gdbarch = per_objfile->objfile->arch (); - ctx.addr_size = dlbaton->per_cu->addr_size (); - ctx.ref_addr_size = dlbaton->per_cu->ref_addr_size (); - - if (push_initial_value) - ctx.push_address (ctx.obj_address, false); - try { - ctx.eval (dlbaton->data, dlbaton->size); - result = ctx.fetch_result (); + result = ctx.eval_exp (dlbaton->data, dlbaton->size, + per_cu, frame, addr_stack); } catch (const gdb_exception_error &ex) { -- 2.17.1