From patchwork Fri Jun 23 04:44:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 111912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5527276vqr; Thu, 22 Jun 2023 21:45:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5cIghVdmfO7guKQgMuvLY8ZMgADg2gYhza2D427r+St7m9hFZ9DxkJYRxYLTvcsHE9bTch X-Received: by 2002:a17:907:72c7:b0:98c:e72c:6b8a with SMTP id du7-20020a17090772c700b0098ce72c6b8amr4892156ejc.10.1687495549202; Thu, 22 Jun 2023 21:45:49 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x4-20020a170906298400b00988c552332fsi4042919eje.300.2023.06.22.21.45.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 21:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=uZ00h8k2; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C73853856DCD for ; Fri, 23 Jun 2023 04:45:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C73853856DCD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687495528; bh=LQJPIpdJNsH5MBq43bNzCMQ7f8cRt+30xCqaktLOazI=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=uZ00h8k2yNJDiQI5sj/RlSj2T3lfN2F0CwFcI4IYFP31D1bMVRA9u+LuJ82n4oRsR zpF+gfL1PYm98aoDMq7DB2L1vjIuQAg87poSfhSGMloNGeBjc7F/0eVFKZqrE0XFHf cNKIDMfKaweESoLlMUW+hvlgyE1yqXejptBfYPM8= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id D04543858433 for ; Fri, 23 Jun 2023 04:45:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D04543858433 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35N4dKgN028127 for ; Fri, 23 Jun 2023 04:45:15 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r94qab17u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 23 Jun 2023 04:45:14 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35N2ASsS038671 for ; Fri, 23 Jun 2023 04:45:13 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r9398g437-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 23 Jun 2023 04:45:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yud45leSuDUC1q3L5ezsRg532lhV1aS60OI8zWuJ43s8HXbdplifGVsQf5JA23YRzwVt+BUnsJNhGDVOEZ/fx2QVC9LpwwgTU/33bWsWEpBeaVxvOWxokDSTg90LLFW3ieuLJW0lAOJ60Y6w6hdaPJgBzOxWuVkqsJcayMmeIUZRMRo3UgVxgN1YCX6VsgXiAz7ffpBqv4HYOPPikl2gKOjbuy/4nvdntuRwQXcsqWqkVYLvgtKyLP+2Nfr4SK4inE0FRVdP1vE2L1hwMG3PihuP95Xg3gbALU6fuSmv6Kw227eWmK3zSKtxHLpP7MGQL25P4cU7WfJqyoVnZS4ouw== 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=LQJPIpdJNsH5MBq43bNzCMQ7f8cRt+30xCqaktLOazI=; b=ERGzsvH6kv3EwtIcFn4cBwI24vTokbc31CG1JCPXi8N9hZLUYaH8R/0YCtzGaKmgcggxADzoCqaDVrvJj/pBrjpR83IVWh4wgWRbMGB8hCchHQUWiMO+Bm2gAO77THJyE8EQCUw66hhok9Q/AbAo1LiLztm8wRKk2FDzN1qofc6CSemzNVSW0nMeRRhu5NZm98dwYZvAAwXuqRlJ0ITMDEGrKKtRVJ4NcCd/jYG+hCGfUF8b4XOIO74Z1s87vgYFxpVgqzEreNZBl/8ey76W8NyZ489lDKK6uBh6LHrcQuKXDDsMXgD5LxbAnJZlhx8zyU6IKH4550fL5Ha17F/c0g== 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 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by DM4PR10MB5966.namprd10.prod.outlook.com (2603:10b6:8:b2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Fri, 23 Jun 2023 04:45:10 +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; Fri, 23 Jun 2023 04:45:10 +0000 To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH 05/10] libsframe: update the semantics of sframe_fre_get_fp_offset Date: Thu, 22 Jun 2023 21:44:43 -0700 Message-Id: <20230623044448.2617101-6-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230623044448.2617101-1-indu.bhagat@oracle.com> References: <20230623044448.2617101-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0093.namprd04.prod.outlook.com (2603:10b6:303:83::8) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|DM4PR10MB5966:EE_ X-MS-Office365-Filtering-Correlation-Id: 1cbda64f-5664-4a52-f7d3-08db73a4a023 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Se0Kf2JjIXT5gpwX69N50R6lz2LmxK1qSSOAtep0wh14vKP7ngChs46iLQfz9tc8jRfo9IvrAePM60EvJdY/ohvM2UfK4SqlUoPo/YM8Uzb1ux54mjMWos+Z3raBp8fjSX3amohce5ys+lojwBPB0dmx8dvsOzE+PU9Yha3uV85IFgW2dwdEOKF2HNhFKEk3c3YvXt2WG42ww2d096nKhZk4s+gdOlxlHGda1OVntdkvTtTUoHXeBnEefzkaZya25WHDyZ8Ihtt29PWQ0SGMnZo9Tev9+9aWJAFeVL7OVwBY4c4NGdj44ax12ld36ai0RA63t1A/ZDdiIqsinbNl2yBVvxKHt065AQgRwWFqbAufJIGhsittVqkWu8+1CGPjMllkDVUQE3Y3zk32OUGxQtnMWMrYJBVh6N0eXsKs7JD2aojNl+pgLDjPzHRvxjGJQZ8E/YSIT2dl78CIGcTSToqOMbvtPbIZJp0yqSu2Ue4YknslcBGFBG4YOWPe56B7+d10K5MrVu6lFzlRjAH9Nl2XU2mQysIRUVXSKzThmXNIvKs+802HEzhnbbYm2ok8 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)(396003)(136003)(346002)(366004)(39860400002)(376002)(451199021)(2906002)(478600001)(38100700002)(2616005)(36756003)(6666004)(5660300002)(6486002)(66946007)(66556008)(66476007)(83380400001)(316002)(6916009)(86362001)(41300700001)(44832011)(8936002)(8676002)(4326008)(6506007)(6512007)(1076003)(107886003)(186003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ByE/ZNrLuSCjVJ1JUxcSOv10U7IpTBVZxIEoY0hQBRT2xssLzirOX3PNikKNCceiuHvlf4arwA1wNVYa2qVCnMNdyQneOVPb2xy6vNB68wRxONl+A0iDx3vSCA6202jdPvrRlwKPNBEr+qKS/PVzrwDhuFwKXfdfv1MAZl5HjeFhTTwbS6sHvxXHpJif3p+5X4os2iVGLeRGAoP7vCy/KpoGZY2qseyfoSde1WpZztw8YQCfnhPRFlwkapd5WyLvVJ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Q0UjZ1qKlspv0CFSAM1gDFxRjZvreNKhYcWm6dLKd X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cbda64f-5664-4a52-f7d3-08db73a4a023 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2023 04:45:10.8098 (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: cnpxvV6KiEg43aNqo+qnAvzv14wwgOIQDa9dkyGbqaDF0ZULrJywA/CfxUTdw6JtU1xKhQi+Bp0ZgLidr1gXVg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB5966 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-23_02,2023-06-22_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 mlxlogscore=815 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306230041 X-Proofpoint-GUID: eEK7LA4jjCUIeZt2vOd2JAXoH2dwEzRj X-Proofpoint-ORIG-GUID: eEK7LA4jjCUIeZt2vOd2JAXoH2dwEzRj X-Spam-Status: No, score=-13.1 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Indu Bhagat via Binutils From: Indu Bhagat Reply-To: Indu Bhagat Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769467332738255756?= X-GMAIL-MSGID: =?utf-8?q?1769467332738255756?= Until now, sframe_fre_get_fp_offset () would return SFRAME_ERR_FREOFFSET_NOPRESENT if the ABI uses fixed FP offset. A stack tracer, then, would call an explicit sframe_decoder_get_fixed_fp_offset () to get the FP offset. On second look, it appears to make sense to hide these details of whether the FP offset is fixed or not in an ABI from the consumer. Now, with the changed semantics, the call to sframe_fre_get_fp_offset () will fetch the fixed FP offset if applicable, or get the FP offset from FRE when there is no fixed FP offset. This patch changes the behavior of sframe_fre_get_fp_offset (): it turns an error into non-error. This change will be included with the next release of libsframe, where all the exposed symbols will be versioned with version node LIBSFRAME_1.0 for the first time. libsframe/ * sframe.c (sframe_fre_get_fp_offset): Return the fixed offset, if applicable. Else return the FP offset from the FRE. --- libsframe/sframe.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libsframe/sframe.c b/libsframe/sframe.c index 3d1b5575f0b..912d34352a1 100644 --- a/libsframe/sframe.c +++ b/libsframe/sframe.c @@ -644,16 +644,21 @@ sframe_fre_get_fp_offset (sframe_decoder_ctx *dctx, sframe_frame_row_entry *fre, int *errp) { uint32_t fp_offset_idx = 0; - sframe_header *dhp = sframe_decoder_get_header (dctx); - /* If the FP offset is not being tracked, return an error code so the caller - can gather the fixed FP offset from the SFrame header. */ - if (dhp->sfh_cfa_fixed_fp_offset != SFRAME_CFA_FIXED_FP_INVALID) - return sframe_set_errno (errp, SFRAME_ERR_FREOFFSET_NOPRESENT); + int8_t fp_offset = sframe_decoder_get_fixed_fp_offset (dctx); + /* If the FP offset is not being tracked, return the fixed FP offset + from the SFrame header. */ + if (fp_offset != SFRAME_CFA_FIXED_FP_INVALID) + { + if (errp) + *errp = 0; + return fp_offset; + } /* In some ABIs, the stack offset to recover RA (using the CFA) from is fixed (like AMD64). In such cases, the stack offset to recover FP will appear at the second index. */ - fp_offset_idx = ((dhp->sfh_cfa_fixed_ra_offset != SFRAME_CFA_FIXED_RA_INVALID) + fp_offset_idx = ((sframe_decoder_get_fixed_ra_offset (dctx) + != SFRAME_CFA_FIXED_RA_INVALID) ? SFRAME_FRE_RA_OFFSET_IDX : SFRAME_FRE_FP_OFFSET_IDX); return sframe_get_fre_offset (fre, fp_offset_idx, errp);