From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 527893858028 for ; Tue, 27 Jun 2023 19:52:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 527893858028 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35REPbGO015515 for ; Tue, 27 Jun 2023 19:52:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=1Wa0C5PMcZWx0bM17a6QcGGrSwg7A2239F45hmXPOVQ=; b=oN5RYUfEz8E3I+LMRqTry0RzvvtQ/3QJ2x9EO5cHQfUe7K7xCPSUCS6oQWfRyuTEbuwF Qam8VLdM6IWDOcoPFyvqJmHz3thxecwje7rxnFTT17RYAxJYJGrbIh6ltXLAVbESoACq XNomvBwzWymn6dd2G65b4CXoEJ1aU31r9O3It/OT5Hvyb3Mt0FfnUafrVXqkDlPM3Xgz sKk1cgFebp5N4sOmHLG9rSxIq4pXtBjIG2BfMQdnXlAEFBpVlRUXuQ39dbXyXtDLHR+s j6aCheQ9yRYvh2/5QtWGLa+372guqx6TcEtGGpAPPm07tEe+IoF5S+f+jdWNQi71rLQb lQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rds1u5sm7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Jun 2023 19:51:59 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35RJjC6h038332 for ; Tue, 27 Jun 2023 19:51:57 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpxbgh44-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 27 Jun 2023 19:51:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WxteiKTPnnbeMmyG/dnItcz8X1hny4Dl2KD3OA96U2JqIf5Jlu5nHMDwHVdD5Vgtpj6qNZm29m3vBWgs+Hl7/dldbNrOdmYajoneRZXakwVk3n7TbYN689bJxsLaXgUzUjNdByDBkAedkxMY20JWj1vhVU0PiTwhgS13ro3FPu2IwB4WI0Fase9mv+lMIpWxVz17DRHtXe7kSJnSUDw1B+U1Hy4MYsRr8AEtUZda0DrqNuQM1Zx2DaeV5FUciXZEM0QZl1y99rxMUW2EB5K/TRoYDaUilUcn0vntmWLg6bXtf/FRrusFOtWH3/7ZHZAPZYoDb1yA/J3z+D4Pr0nUDQ== 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=1Wa0C5PMcZWx0bM17a6QcGGrSwg7A2239F45hmXPOVQ=; b=ULS5Hcq792vo1HZ4KXkJ2ELQlxdd8Du9RkntuR/h5rObaQRPK7EQz1uVfKrdGwlJ2bzPe6yXJPCABfOlFYH6fluilSPJWVXN2iqEwkl6TNGxtwjTpiqiJtk29AcMHIuhj+zwMVKx3bS6BXcVxch75ccURwtgW9p5OHSPuecLijvmWjc5KuriRLXwg/kV+KRHz5d+odPDWjwEvx8uvXho1xRFZBYyKMzfKOM7mvqx/YD9z81DvE2stQhGk4btGunDfMlLjzi2LB5JqTlskXl6fLCZqezfPqNfp4MYmW7WiOyDpA3r6O0CmGRB2wKOtXnn77emHLsi5Hq+MmDkvxfu6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Wa0C5PMcZWx0bM17a6QcGGrSwg7A2239F45hmXPOVQ=; b=NlIfWZAeXdGDmTV8oGOWROVMi4b70AaLlLOS7vth80AhI/yMhthB1h3RY7rmq9zD3+4HwQRpHMZhfynMbegWzJYc/5cY+JWEyCfxMhSSgHvrTPp2ObO37YsLieMXPk2ZIJcLbEfmhgKs3fjdKaf3ASrtP989mxOs4PhHQgOY1Yw= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by BLAPR10MB5361.namprd10.prod.outlook.com (2603:10b6:208:325::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Tue, 27 Jun 2023 19:51:55 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fdbb:b921:1ef:2d44]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::fdbb:b921:1ef:2d44%4]) with mapi id 15.20.6521.026; Tue, 27 Jun 2023 19:51:55 +0000 From: Indu Bhagat To: binutils@sourceware.org Cc: Indu Bhagat Subject: [COMMITTED] libsframe: update the semantics of sframe_fre_get_ra_offset Date: Tue, 27 Jun 2023 12:51:18 -0700 Message-Id: <20230627195126.1955051-4-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230627195126.1955051-1-indu.bhagat@oracle.com> References: <20230627195126.1955051-1-indu.bhagat@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR03CA0220.namprd03.prod.outlook.com (2603:10b6:303:b9::15) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|BLAPR10MB5361:EE_ X-MS-Office365-Filtering-Correlation-Id: adcd631b-0d7b-43ff-5137-08db7747f584 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iVZbLa678ZtRqIKUQKs3ttDjjDgLcy/iHnpqvCqrd/8Rpg0teOlmKK2pHUVNS/sMNdfmWRLw/axEyexzZo+ipzUSIDq582bCunw+rb6nmSNqAC/TAWJEJYn0R7+g7bZnjLTl5fIN3WWVmTHRSHMOwygxUvHUceFvC1OqvAAk/oshLdcNMKnTrUZcLynyy0Uhd8YGu3XocBBB3aNGXgSM9SviIfqqT4k7JgR0CyK8v7UmU+Va9wLuk0cL2xpy7UyUHoPmwPoJYnUFXSq7uGBIrkmKibLaowX7yzHN6tCSAk3n9vGM+M7dNSIuei4yMla1GPMu31HXXcB1b34BriDU2NRgwK1pA2qyBA1Tl82SisLqB5ItujuWbdFPRF0RoDTGbRQiAAjuxv5eQkhdBT4Ms4lDHi+oYu3B1eKHMFWb5jmKEpAgKewkc3IbiKoghjVvlC96wz8im4Qc9oaemOE2zAtccWQLRMqoPp8ThWVyj4ZszkKy56RmTHUDICN10cBdFuSGehOyY9SkfClQZGCYpJ7VCOPGd/a0uvC0+bNHlO4Kl+T3QTOVPZo9oahT4qh4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2158.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(346002)(39860400002)(396003)(366004)(136003)(451199021)(1076003)(107886003)(6486002)(83380400001)(6666004)(26005)(2906002)(2616005)(6512007)(6506007)(478600001)(186003)(5660300002)(44832011)(36756003)(38100700002)(316002)(4326008)(66946007)(66476007)(41300700001)(8936002)(8676002)(66556008)(86362001)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rYdWkQt0FY3hLMgEJCmsxbr04unudbIaJVRefOP20n5xFIS8O5KdjsFJhU5d?= =?us-ascii?Q?oEnxe9nvy1Wwbe7Le4ZHsgVrdvrFTtAFf7+2QLEM8qamhzESI1cqhCx3klub?= =?us-ascii?Q?v2GLd0m9eyG7pS3ErWWqALrKNZfe3A1yUmTSgDfqM7RpsQJ474LBEAuxiUnp?= =?us-ascii?Q?Uz8RlNwt+JRsk5AWVbEqoJau1dK2BiX4esJ4DOp2vCpeXG6WSidESeAG1fdy?= =?us-ascii?Q?xy158Isfq618L7dXmtEkiXKperJ7EAPeOneUVrljYwYV3hp/giK3ccFuQTiU?= =?us-ascii?Q?mO7gdVbHEqKbfdDchcnPpZ1co5UFOQwc1C6+enJ/LpGdRDE/ymD8hzKdeI6p?= =?us-ascii?Q?/6EjqQdJYBKxC2XlNXKJwLuwtrFeRtJzdBlBMNVRnXcMpJz6jusK3Fy2se0f?= =?us-ascii?Q?SNzZvm2Tewd6bORrr7jn0fwdN4eltPFC6L0UxL25jtxMIJGuE2VTyEXwDN15?= =?us-ascii?Q?aiq32QW4TYKDfl7iVCnGPdn5InK9oVGfzyeLk4BVUpLARp0MzPt1XytMpR8m?= =?us-ascii?Q?cVctjKqWG25PwH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lGmDZw?= =?us-ascii?Q?ncNcST08/dTOzJJ7WE0eSmtU0tFQDTbOPcSSKRwCa+TkykFXxpdJtqRCW6BJ?= =?us-ascii?Q?qDRSwCmZzPZedlXfB118itlAF7VIMns6oc6qXcLeFZPiHiaqclOAloH9jwFd?= =?us-ascii?Q?yWHSGP/M3XKTQvRnVTrpid08XTN14h5j4neisDNO?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ABd2BEkwRu64lWcrgAHlEo7+a3XqOxZW1NzOYynygRjwRXm0VDQckLaNuOFDKpN4k0+Zt/LPCvJHqiub4mUuscv1Epe69Wos0eFZ4rXeblxjnTV4UdDAI2UgT4uUbrfyA/EG1GXAFv9jM8r3Hwd4GymYnuREEVVIcGzeFaI3O80gDaI5YRn/eL96GJJAnnZZfyJsXDdoejMjsIyZPJojTL7X9VtGmGJMdbPsXfUL/IebGimCaDCdbRf3t08uRZ0E6h+j9dvp4zENuOGXZ0wjk9vHB9zhLyGWP47964fqXFHK3QkjFRzgY4qm/wCax8oxiXV9kM1JFg+utr2VU8ethmW6iBLMd1nXBf4+AQuAB+dPTl1IxdjuEackZtp6xH2VvqU/9i/jH0MEgZjRhAohzZ48VMonz4wVOXQPPM+Glv/um/0DrwNijuQR/wEISt9gAKJrxq5UrZve5xqsF676xgQukADI9dY0GQDUiuL5LRFvOIGv75RBvkyguRbyRu1IOtI+xBKmpXQQ6uvEL3wFIwS8XgJHVC+QuiNXqF+LcAoqhai50qKmTd40XSYDLJSETHFC0hj2sIXJMQ/kiORn0ZhHqF0AarwFRgtPCFynBOAQee8ikrd/J5jDrcNOnnjOtjgDr7jnDQk6hGm33FsPZbdwS+SWAdAm4DdyxniYreF2XAorFRswMnlCym79H8IlGCWPR0SWKRxNCzHMj1fnza02hSLJv7l9IDvzvWdIRuRl/7WZpcGTcOqeOJzPvfew X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: adcd631b-0d7b-43ff-5137-08db7747f584 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2023 19:51:55.1218 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lfEpxS+N71zU891q37HI0xwQDKMT2i0eKxsQCFaTnQnFDDFIZuZiMlcfRiWMbcYdcxvQ/XskaXl1Ej51osq30g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB5361 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-27_14,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 spamscore=0 mlxlogscore=854 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306270180 X-Proofpoint-GUID: ADZSXKeGlF1dEFxOTf2g5rGOIAUYGpKH X-Proofpoint-ORIG-GUID: ADZSXKeGlF1dEFxOTf2g5rGOIAUYGpKH X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: Until now, sframe_fre_get_ra_offset () would return SFRAME_ERR_FREOFFSET_NOPRESENT if the ABI uses fixed RA offset (e.g., AMD64). A stack tracer, then, will call an explicit sframe_decoder_get_fixed_ra_offset () to get the RA offset. On second look, it appears to make sense to hide these details of whether the RA offset is fixed or not from the consumer. Now, with the changed semantics, the call to sframe_fre_get_ra_offset () will fetch the fixed RA offset if applicable, or get the RA offset from FRE when there is no fixed RA offset. Adjustments need to be made to ensure the textual dump remains the same as preivous. Currently, e.g., if RA is not being tracked per FRE, following is seen with objdump --sframe: STARTPC CFA FP RA 000000000000NNNN sp+X u u This patch changes the behavior of sframe_fre_get_ra_offset: it turns an error into non-error. This change will be included with the next release of libsframe, where all exposed symbols will be versioned for the first time. libsframe/ * sframe.c (sframe_fre_get_ra_offset): Return the fixed offset, if applicable. Else return the RA offset from the FRE. * sframe-dump.c (dump_sframe_func_with_fres): Make adjustments to keep the textual dump same as previous. --- libsframe/sframe-dump.c | 12 ++++++++---- libsframe/sframe.c | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/libsframe/sframe-dump.c b/libsframe/sframe-dump.c index 6d266392cd7..2491b4391f3 100644 --- a/libsframe/sframe-dump.c +++ b/libsframe/sframe-dump.c @@ -164,11 +164,15 @@ dump_sframe_func_with_fres (sframe_decoder_ctx *sfd_ctx, strcpy (temp, "u"); printf ("%-10s", temp); - /* Dump RA info. */ - if (err[2] == 0) - sprintf (temp, "c%+d", ra_offset); - else + /* Dump RA info. + If an ABI does not track RA offset, e.g., AMD64, display a 'u', + else display the offset d as 'c+-d'. */ + if (sframe_decoder_get_fixed_ra_offset(sfd_ctx) + != SFRAME_CFA_FIXED_RA_INVALID) strcpy (temp, "u"); + else if (err[2] == 0) + sprintf (temp, "c%+d", ra_offset); + /* Mark SFrame FRE's RA information with "[s]" if the RA is mangled with signature bits. */ const char *ra_mangled_p_str diff --git a/libsframe/sframe.c b/libsframe/sframe.c index 8837f878fb0..3d1b5575f0b 100644 --- a/libsframe/sframe.c +++ b/libsframe/sframe.c @@ -665,11 +665,15 @@ int32_t sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx, sframe_frame_row_entry *fre, int *errp) { - sframe_header *dhp = sframe_decoder_get_header (dctx); - /* If the RA offset was not being tracked, return an error code so the caller - can gather the fixed RA offset from the SFrame header. */ - if (dhp->sfh_cfa_fixed_ra_offset != SFRAME_CFA_FIXED_RA_INVALID) - return sframe_set_errno (errp, SFRAME_ERR_FREOFFSET_NOPRESENT); + int8_t ra_offset = sframe_decoder_get_fixed_ra_offset (dctx); + /* If the RA offset was not being tracked, return the fixed RA offset + from the SFrame header. */ + if (ra_offset != SFRAME_CFA_FIXED_RA_INVALID) + { + if (errp) + *errp = 0; + return ra_offset; + } /* Otherwise, get the RA offset from the FRE. */ return sframe_get_fre_offset (fre, SFRAME_FRE_RA_OFFSET_IDX, errp); -- 2.39.2