From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 710B6393D02B for ; Mon, 7 Dec 2020 19:01:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 710B6393D02B ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YP2WR4Af7nktvPWOCNYLgEowvW3pIe+c5TF3xICqwCzS8Z5R764VMP2rhEOx3NWWbf6PV0kOXg2Z0TSgDePH+whp1c7sJOH7X4rHQMWyhI76CY6yLafVGGbtLY2ZHq48aDSnMpyDxpOgkHN4k+vWt6fxrPuFz67DfyDuTnLIlOJU34JVSuR6cJCbALkEKmk/IpPNShq4BOmAEvsCDkCqFbGKQ4ERSxJasTYR6vgr8VXaXvJ6b9gdl3TdNDss/97Qnd0JTovNiT+tIaJh01zSkAS9yJ1MfqCKJTs0os6WAv4wXOdNkqzPrKshxW9NEcR56CgV9nBEFCVnPQelLk7rEw== 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=MbLTKKnaflhKKUd8BdWuoTytmuGMb/WHPvAU9XoHank=; b=Qancbw2HUdiuc6ih7iqPCtjoQSIwDWmEbO7KPHrPQi4j6eRUuqe8SLtd04xXvum5lGI+0ElIMQ5qkiS5MTYQPgZtP+ajnCRLBeDT+UQ7mpmJ+mcLD86kMaTqLraqTfZgmy9Yg1xBTutQ3o98yh74p2avW5mcKeQD8A7JyUmD42N9QctDXa+UaVn2YjIyWMIraTi07krVQfoO/YmPUf7ND18TJODyZxex8TpCTWScS2N+MFLNAMBLxdSpb9mZVtsrVNRwvK4VLjmwpDZOC55yVydWDgrROA/eun/yJFIuRSGZgrwctiFwiZmTgnSKPezPfpjgbYWtYjMEWPCt5atQYA== 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:31 +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:31 +0000 From: Zoran Zaric To: gdb-patches@sourceware.org Cc: Zoran Zaric Subject: [PATCH 24/30] Move read_addr_from_reg function to frame.c Date: Mon, 7 Dec 2020 19:00:25 +0000 Message-Id: <20201207190031.13341-25-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:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a5a1350b-1f39-4e13-46b1-08d89ae28287 X-MS-TrafficTypeDiagnostic: DM6PR12MB4561: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4Ub5WiM8IgN7hpzRfqhWcJl0Tc6IhB5rBPSwDIxXu9n6MSh/Er2f+YnHRJqRf7Jds3u/DLU3su+KI9bVrd5zD9UmQT7Py/SZ2Ye5+QOcXtO8a0F7nMOuPtWDlnIe2jt8ccazFj3W3KmQrOuQlUOJQgt8apUxV36VJPiqy35rKbtVS3MqabcMaX2wK7iK+lhQTTmGWVf3afbyKO0NC7I28r20UV0YJuvqaW0A0bgNhIbIh+7xbN0kAjZY46kTlxOvfk3+wTqbD2r/Ay1/feT0cqPhOYqhKAXGvfvWaoi7MIYcAB1Z+kNN5GY00hU2dBu/Ce5PTUehXCYYSDFILq//ALwRBIy42gMHYMyI9d3x0IBWu4E8LFfZZ0sQShJH1Fkn 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)(83380400001)(86362001)(6506007)(4326008)(69590400008)(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: =?us-ascii?Q?WZMTY8SI3Q4qKO4buWwW4ntKDX4LAKF2GHaxA4tkW0iZuFxBeqrhS3GkZDtL?= =?us-ascii?Q?EIinhDeWW9t9pj3umLEwvHZlx0+btzY78b+LoyIDZWcb8mzA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U7tbxESSg1wMpEYpSucWQIhBb3Lku2hHhGz/BiEjgX7lIOvsoVKP0c?= =?us-ascii?Q?CZoXLLVguRcCHfsGmwF/5CtPv8gj3G0zaOI6jTXKkgRvOkIPFuhNIEnE3Sod?= =?us-ascii?Q?QXZ0vcBw?= 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:31.5595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: a5a1350b-1f39-4e13-46b1-08d89ae28287 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /FAyy0yaZ0GAPFak50SdD4l7AO03N0xS7hsq0CUU/mWflJ0LSthmeWFoxMfvyBel5VYK6ijZiUXV86iVdeFwgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4561 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: Mon, 07 Dec 2020 19:01:42 -0000 read_addr_from_reg function is now only called from frame.c file, this means that the function can safely be moved there. gdb/ChangeLog: * dwarf2/expr.c (read_addr_from_reg): Move function to frame.c. * dwarf2/expr.h (read_addr_from_reg): Remove function. * dwarf2/frame.c (read_addr_from_reg): Add function from expr.c. --- gdb/dwarf2/expr.c | 11 ----------- gdb/dwarf2/expr.h | 4 ---- gdb/dwarf2/frame.c | 12 ++++++++++++ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index a259f5d5d5..9f2c77197a 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -97,17 +97,6 @@ ill_formed_expression () error (_("Ill-formed DWARF expression")); } -/* See expr.h. */ - -CORE_ADDR -read_addr_from_reg (struct frame_info *frame, int reg) -{ - struct gdbarch *gdbarch = get_frame_arch (frame); - int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg); - - return address_from_register (regnum, frame); -} - /* Read register REGNUM's contents in a given FRAME context. The data read is offsetted by OFFSET, and the number of bytes read diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index 5fb4b0857e..63fe789939 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -51,10 +51,6 @@ struct value *dwarf2_eval_exp (const gdb_byte *addr, size_t len, bool as_lval, ADDR_SIZE is expected size of the type. */ struct type *address_type (struct gdbarch *gdbarch, int addr_size); -/* Return the value of register number REG (a DWARF register number), - read as an address in a given FRAME. */ -CORE_ADDR read_addr_from_reg (struct frame_info *, int); - /* Check that the current operator is either at the end of an expression, or that it is followed by a composition operator or by DW_OP_GNU_uninit (which should terminate the expression). */ diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index dd4eca9aac..1469621133 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -192,6 +192,18 @@ dwarf2_frame_state::dwarf2_frame_state (CORE_ADDR pc_, struct dwarf2_cie *cie) { } +/* Return the value of register number REG (a DWARF register number), + read as an address in a given FRAME. */ + +static CORE_ADDR +read_addr_from_reg (struct frame_info *frame, int reg) +{ + struct gdbarch *gdbarch = get_frame_arch (frame); + int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg); + + return address_from_register (regnum, frame); +} + /* Execute the required actions for both the DW_CFA_restore and DW_CFA_restore_extended instructions. */ static void -- 2.17.1