From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id B85FA3858288 for ; Fri, 12 Apr 2024 14:47:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B85FA3858288 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B85FA3858288 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712933267; cv=none; b=BYWKwr6016Y9e9MSldk0zYZpGPdb/Qv0gsyAsrgxcyegqwqAirIacSTkwUxxlxDRnW6osho8oz52Pp35Yx9PDPUIQ1W+wRZQ28Pfn3f9x+9WksH778ofYxbIcBqzvRF+cDg7O47v7pXvEPXeujTv69feobMUxTsIzoak9GUA+yA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712933267; c=relaxed/simple; bh=wajf1fRKEUXHkR2SZeLcrIKO1/4+mU6nTm8XTS5Xbss=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=oRdNf5OIdfe8eg8AS0VmcfGzlSLpb896UnjckKMKmYnfUMQV1QJoLyJilNf3U5vejIuE3qxAUTcibfFXQ2u28LxYRWTp3UziI5CSl1Xot/iypRfci/W92zWzGKHwClfjHlf51OwhJrxewPzHiwIc7GW3JwGYnyvM63QLKIdahSw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43CEgBOd001378; Fri, 12 Apr 2024 14:47:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=dnmV+nnsBuFUeqyMU0zeZZrZ1eZkvWTjnj4+bxnTUuM=; b=VHZ3BSmAh5p49mfG1MOBmfHhkxxSKKi4jtqSIfwQQoVXcieFwI7DZe+mu2aI1sgcSxnx 25vN0A6qzmc+r632JixC3qN8aOF5BZqFz6xEEg55uzEfP9EXCTiLLqZJa4yV6M+QJuek t6NfrlYt0vtgERPXNiVv8hr7pw72/eKLvpZKyhMC9CFMosdPb6Dm5o7uVkb+KNsAveA+ bG54hW35gMQYE7m54CSGcl52AbNjj4qWCxQD9mHeyDs9LFZOvjf/MqzDZ9oMl/37xFRx 1KL3QXcqCcGAU1ngCOsEU3gW1f3oHSf81M3g5S/GVWZ3Lij88XLtlfDl7i3Qiaoo234p KA== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xf4pg8av8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Apr 2024 14:47:43 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 43CCW46B017280; Fri, 12 Apr 2024 14:47:28 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3xbke32003-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Apr 2024 14:47:28 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 43CElN4329950324 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Apr 2024 14:47:25 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8AD292006B; Fri, 12 Apr 2024 14:47:23 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6FCEE2006C; Fri, 12 Apr 2024 14:47:23 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 12 Apr 2024 14:47:23 +0000 (GMT) From: Jens Remus To: binutils@sourceware.org, Indu Bhagat Cc: Jens Remus , Andreas Krebbel Subject: [PATCH v3 08/15] gas: Refactor SFrame CFI opcode DW_CFA_register processing Date: Fri, 12 Apr 2024 16:47:11 +0200 Message-Id: <20240412144718.4191286-9-jremus@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240412144718.4191286-1-jremus@linux.ibm.com> References: <20240412144718.4191286-1-jremus@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: yiBFOhFS-1T0Bh9ep8rR1q4c8qkD4XcQ X-Proofpoint-ORIG-GUID: yiBFOhFS-1T0Bh9ep8rR1q4c8qkD4XcQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-12_11,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 suspectscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404120107 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Refactor SFrame processing of CFI opcode DW_CFA_register into a separate function. This harmonizes the CFI opcode processing. While at it reword the comment on CFI opcodes that are not processed. This is a purely mechanical change. gas/ * gen-sframe.c (sframe_do_cfi_insn, sframe_xlate_do_register): Refactor SFrame CFI opcode DW_CFA_register processing. Signed-off-by: Jens Remus --- Notes (jremus): Changes v2 -> v3: - New patch. gas/gen-sframe.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c index fe8b24906c1b..f47f51c7a354 100644 --- a/gas/gen-sframe.c +++ b/gas/gen-sframe.c @@ -1108,6 +1108,28 @@ sframe_xlate_do_val_offset (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED, return SFRAME_XLATE_OK; } +/* Translate DW_CFA_register into SFrame context. + Return SFRAME_XLATE_OK if success. */ + +static int +sframe_xlate_do_register (struct sframe_xlate_ctx *xlate_ctx ATTRIBUTE_UNUSED, + struct cfi_insn_data *cfi_insn) +{ + /* Previous value of register1 is register2. However, if the specified + register1 is not interesting (SP, FP, or RA reg), the current DW_CFA_register + instruction can be safely skipped without sacrificing the asynchronicity of + stack trace information. */ + if (cfi_insn->u.rr.reg1 == SFRAME_CFA_SP_REG +#ifdef SFRAME_FRE_RA_TRACKING + || (cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG) +#endif + || cfi_insn->u.rr.reg1 == SFRAME_CFA_FP_REG) + return SFRAME_XLATE_ERR_NOTREPRESENTED; /* Not represented. */ + + /* Safe to skip. */ + return SFRAME_XLATE_OK; +} + /* Translate DW_CFA_remember_state into SFrame context. Return SFRAME_XLATE_OK if success. */ @@ -1296,19 +1318,12 @@ sframe_do_cfi_insn (struct sframe_xlate_ctx *xlate_ctx, case DW_CFA_GNU_window_save: err = sframe_xlate_do_gnu_window_save (xlate_ctx, cfi_insn); break; - /* Other CFI opcodes are not processed at this time. - These do not impact the coverage of the basic stack tracing - information as conveyed in the SFrame format. - - DW_CFA_register, - - etc. */ case DW_CFA_register: - if (cfi_insn->u.rr.reg1 == SFRAME_CFA_SP_REG -#ifdef SFRAME_FRE_RA_TRACKING - || cfi_insn->u.rr.reg1 == SFRAME_CFA_RA_REG -#endif - || cfi_insn->u.rr.reg1 == SFRAME_CFA_FP_REG) - err = SFRAME_XLATE_ERR_NOTREPRESENTED; + err = sframe_xlate_do_register (xlate_ctx, cfi_insn); break; + /* Following CFI opcodes are not processed at this time. + These do not impact the coverage of the basic stack tracing + information as conveyed in the SFrame format. */ case DW_CFA_undefined: case DW_CFA_same_value: break; -- 2.40.1