From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60071.outbound.protection.outlook.com [40.107.6.71]) by sourceware.org (Postfix) with ESMTPS id 460E03857C41 for ; Mon, 25 Apr 2022 10:00:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 460E03857C41 Received: from AM7PR02CA0028.eurprd02.prod.outlook.com (2603:10a6:20b:100::38) by PAXPR08MB7381.eurprd08.prod.outlook.com (2603:10a6:102:22b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Mon, 25 Apr 2022 09:59:58 +0000 Received: from VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::6f) by AM7PR02CA0028.outlook.office365.com (2603:10a6:20b:100::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.21 via Frontend Transport; Mon, 25 Apr 2022 09:59:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT058.mail.protection.outlook.com (10.152.19.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14 via Frontend Transport; Mon, 25 Apr 2022 09:59:58 +0000 Received: ("Tessian outbound 2d401af10eb3:v118"); Mon, 25 Apr 2022 09:59:57 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0fbe449a96a9a6d8 X-CR-MTA-TID: 64aa7808 Received: from 5251791f7315.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 581A34D7-924B-4E90-A8C8-891241FA5E03.1; Mon, 25 Apr 2022 09:59:51 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5251791f7315.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 25 Apr 2022 09:59:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A6yir3J9z57vAEa7lI8QWrIdrKvVERCh8q3qXAkfuP9tsXPyxCJsAbpw8OUcOpaC/spXKs246lHXlz27NMKlrHbEab+uTZUPGDxlLYI7aOv7rGGtk/ZVZ5uXK5AAMlgkElVVSnGkzQ1ETSc7OO6RlbOGsv/RO2n2pkmV0qdQE9vGVGCiMQGDo257Q6BFQoKUyt/4KdbuT85ALdwKvIeMcfapAehcH7juWm+A2g/9R4/vunfkQx8niqbyjZmowSP+KV7TD9ugIuQFdaXRVsZT2Yi0boAET+OepJIOQnPqL3n/sAvk953YxDGCXpLvq3ziMTj470Asyh2XQWzfXMeIOQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R/d4tDtAzUjdfdqhDHH94IEUr2G73wSA5GmKChGipNE=; b=IQjuTS4j4UkFRoKhhr6i50b94SOY/CXVzYvbFeA5Axw7K5Ul/WZYFnRiqjOtGWSsX7xxA8CDyDBNJ7mAelB3Tji3WdbDyDPE/lImh8Moaram8Ji6WWj9O4vDmmWiSn39ujmytOlok7M6n42K4hpfBIX7b8OMGkSHbbgkY314U656tGi9c6hzaMd31NKb1R3Vi6OX27hqubNTnaO8uWaA9Zugj42PBRFTIz6XKwBRuStTQ3rR8PO1ORrNLZi7ar0OYiztyO57MhpQR44v2sABuwd+s3ASk0XgMh+XH7iYiTJH0FuV/2qxCLph+Ie7AXoymm8gpzD353d3CgobKdtlPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AS8PR04CA0070.eurprd04.prod.outlook.com (2603:10a6:20b:313::15) by AM6PR08MB3176.eurprd08.prod.outlook.com (2603:10a6:209:46::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.14; Mon, 25 Apr 2022 09:59:44 +0000 Received: from VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:313:cafe::6e) by AS8PR04CA0070.outlook.office365.com (2603:10a6:20b:313::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.17 via Frontend Transport; Mon, 25 Apr 2022 09:59:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT053.mail.protection.outlook.com (10.152.19.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5186.14 via Frontend Transport; Mon, 25 Apr 2022 09:59:43 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 25 Apr 2022 09:59:42 +0000 Received: from e129018.arm.com (10.57.80.40) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Mon, 25 Apr 2022 09:59:42 +0000 From: Christophe Lyon To: CC: , Subject: [PATCH v5 3/5] gdb/arm: Introduce arm_cache_init Date: Mon, 25 Apr 2022 11:59:40 +0200 Message-ID: <20220425095942.62967-4-christophe.lyon@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220425095942.62967-1-christophe.lyon@arm.com> References: <20220425095942.62967-1-christophe.lyon@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 7e6bacbb-a502-4701-3beb-08da26a25b1a X-MS-TrafficTypeDiagnostic: AM6PR08MB3176:EE_|VE1EUR03FT058:EE_|PAXPR08MB7381:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: k2SR6vb63UYttUR0fd62xsVr16Jiqw1UeaB4AZkZhP/OGemOY0IzIibmGa+wwo1Ic5sz/BGsyZHu3N/ztgZbh8q3pztg9CyNVnhFcSuZN5ouPnTzHHaJiJWYtGjJmoXPO705WAIyyNQEigJjeL1HBoa23tHEZvh5nHtemGECiQ+v8LpxJyqMcbEehpvV4kAmQ5W/PEdGRA9vn7rdwb0+xySRnf/uf/4y2iFfrAJElvORDcueA7B0BXKcHdJ8Dj30fh+tbsmXpiZeMrQCrDB2O3Y2+DLczztscGXkj+hFF4V8Ck6HD0FbvMNo42dffTVUt4UqFFCHi0T9db+6krWuURWHn4Sv1ZPe92tquyV3gnhMAW2fFwLZqxngcmhGsJnc5aD02qn1MGA488fGKorU1B5Kt8wWdZvpuBILE30zTlinHuC47/OmkMfuPjqzIxu+9f+Esu9vFSLKD7wJz91BIwupS9lrWz+b5lzWYw7bR3drlV88bPDE/0YNemdP+G1ezC1hL0ZWvJ3KO0omZeP8flmTCan+GXnP0HYeDKcQDMiY7VZ5j+ogwebtAQOCj7gGQyeSS9Wf188fMfwzyEeJR0XLnKIorrqAtRIsXj/W5N4AIyzWaB9wcd+NzkL3Suitsp4qczOJc/Z3yVn3fHTRiqp4/VTKB8txD/0jd7z0wrV1y3nW0irnhIizv8PxuKJIR+zEjTD2beNb882HqguySA== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(2906002)(44832011)(70586007)(8676002)(4326008)(82310400005)(356005)(36860700001)(5660300002)(81166007)(508600001)(8936002)(54906003)(6916009)(1076003)(2616005)(70206006)(36756003)(336012)(47076005)(426003)(316002)(186003)(86362001)(7696005)(26005)(83380400001)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3176 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b960f842-a9c0-48cd-b998-08da26a25298 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6humpDZ/BEss/crnYMN66soN3wBhw6qzrVKApOS6OHwF0n6VZxo7VqwHnvBl7kSlmsbBeUtFrdhIpu5IIXqvamAQQqw+pE3NCmMpcGtcrROnB/eT/mjWJ2FJvP34P0vGTT57McXsbdbsD+mmoVaSsyHoHFYtHePi2LRRPHcvmgsy++lmex823C9CgcgY8KNtTysJ4RuHFW/uAwkLL9pDwt9s1qiG3bmyrYF7miTVFgCVAY7L3GSDZKYEDRa/hyThgrO7gKL2TGrmZHVmOCoqHNPOti81WS7cdFj0OPypsHwU0cvjTaZQWPGrSolUiGyTTvnBm7ssV5TI0pmIyRD2deJQy+h+vUlSFYO6q/AkkrVZkAwAI+ICJyYTtwmoJsA1ieeNbUo4GrwZbuaUPm45ClUaB6oeLjOzfu7T7LXn25aoSihxE87D87uw+JsMOAUBWzzslPcfSduGbsVCL+tGm07Uy13ljQyiVUOEpHKd+5pw3eD5GkeVHyMRVBlZCIDvmSBiQIQVTT/PAgzCjxOEJZCsbiWt++kxo15DGwsOThP6EhlWJRUdEZ1N9lgrrwvfr+ntNPJ0SvUaGXJSjgnoRAMKGLycNmNYNRxHIXFsyWXHUlz1XChGiGabJY96kZWI2DdpESLLNVXOoaQgWQwCGuRjlzJF/ug3rAjQh+8/mNdOx3f4aPIBuV2bsrYE8xk1 X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(6916009)(40460700003)(86362001)(81166007)(54906003)(7696005)(70586007)(70206006)(83380400001)(186003)(426003)(47076005)(36860700001)(336012)(8676002)(508600001)(4326008)(316002)(26005)(1076003)(2616005)(82310400005)(8936002)(5660300002)(36756003)(2906002)(44832011); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2022 09:59:58.0256 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e6bacbb-a502-4701-3beb-08da26a25b1a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT058.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7381 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 25 Apr 2022 10:00:09 -0000 This patch is a preparation for the rest of the series and adds two arm_cache_init helper functions. It updates every place that updates cache->saved_regs to call the helper instead. Signed-off-by: Torbjörn Svensson Signed-off-by: Christophe Lyon Signed-off-by: Christophe Lyon --- gdb/arm-tdep.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 6b4b00993fa..f393a3e4ad6 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -292,8 +292,29 @@ struct arm_prologue_cache /* Saved register offsets. */ trad_frame_saved_reg *saved_regs; + + arm_prologue_cache() = default; }; +/* Initialize CACHE fields for which zero is not adequate (CACHE is + expected to have been ZALLOC'ed before calling this function). */ + +static void +arm_cache_init (struct arm_prologue_cache *cache, struct gdbarch *gdbarch) +{ + cache->saved_regs = trad_frame_alloc_saved_regs (gdbarch); +} + +/* Similar to the previous function, but extracts GDBARCH from FRAME. */ + +static void +arm_cache_init (struct arm_prologue_cache *cache, struct frame_info *frame) +{ + struct gdbarch *gdbarch = get_frame_arch (frame); + + arm_cache_init (cache, gdbarch); +} + namespace { /* Abstract class to read ARM instructions from memory. */ @@ -1981,7 +2002,7 @@ arm_make_prologue_cache (struct frame_info *this_frame) CORE_ADDR unwound_fp; cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); + arm_cache_init (cache, this_frame); arm_scan_prologue (this_frame, cache); @@ -2454,7 +2475,7 @@ arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry) struct arm_prologue_cache *cache; cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); + arm_cache_init (cache, this_frame); for (;;) { @@ -2848,7 +2869,7 @@ arm_make_epilogue_frame_cache (struct frame_info *this_frame) int reg; cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); + arm_cache_init (cache, this_frame); /* Still rely on the offset calculated from prologue. */ arm_scan_prologue (this_frame, cache); @@ -3009,7 +3030,7 @@ arm_make_stub_cache (struct frame_info *this_frame) struct arm_prologue_cache *cache; cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); + arm_cache_init (cache, this_frame); cache->prev_sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM); @@ -3087,7 +3108,7 @@ arm_m_exception_cache (struct frame_info *this_frame) uint32_t secure_stack_used; cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache); - cache->saved_regs = trad_frame_alloc_saved_regs (this_frame); + arm_cache_init (cache, this_frame); /* ARMv7-M Architecture Reference "B1.5.6 Exception entry behavior" describes which bits in LR that define which stack was used prior @@ -13851,7 +13872,7 @@ arm_analyze_prologue_test () test_arm_instruction_reader mem_reader (insns); arm_prologue_cache cache; - cache.saved_regs = trad_frame_alloc_saved_regs (gdbarch); + arm_cache_init (&cache, gdbarch); arm_analyze_prologue (gdbarch, 0, sizeof (insns) - 1, &cache, mem_reader); } -- 2.25.1