From patchwork Thu Jun 8 04:49:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 104818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp42559vqr; Wed, 7 Jun 2023 21:50:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XqK8sCMGeDs3vCsFf2xBoFdUhOtSHA+hjjmMt257JI6mrcrxKCgXBrQMgyD3nNOy2rT96 X-Received: by 2002:a17:907:72d6:b0:977:e501:cc01 with SMTP id du22-20020a17090772d600b00977e501cc01mr1020873ejc.24.1686199811793; Wed, 07 Jun 2023 21:50:11 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e7-20020a170906248700b0096fe1a56de3si196399ejb.1048.2023.06.07.21.50.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 21:50:11 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=pj80vR+7; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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 7E6DC3857031 for ; Thu, 8 Jun 2023 04:50:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E6DC3857031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1686199805; bh=tmpAlmvABhKVF0pnMV+eps0gtMce+GwvLpsYb9H3Q9k=; 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=pj80vR+7lTmVY/P5JP0B5CgwSMx3L8muITgK3fBivGI8Va3h9QH7l3shqVhXd7YtB JvSpUwxIMy77dZZlvNykjeMURm50ZENh11dJ9SjO/7wEPaSnRBDO7LPwzaEM+9bKx/ 5t1BU7zd8uxDbN7LD+jQxD1jwymD9EHs5RdI0Cao= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id CFD813857701 for ; Thu, 8 Jun 2023 04:49:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CFD813857701 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3580D9uq007991 for ; Thu, 8 Jun 2023 04:49:50 GMT Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r2a6rkayy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 08 Jun 2023 04:49:50 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3581f7Hw015853 for ; Thu, 8 Jun 2023 04:49:49 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r2a6mm5md-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 08 Jun 2023 04:49:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ek1oKsKwn08iXd2Z1m5MY1u+7RU2SdXEUzyRarzyiL7QlFxWmRVwSvYWd6yCda8azI+InYDxrwNBpUKOEj+g86uDKkRKuh1icm3CRmy8ldhFZidSJnQovxt9zwlVqtSaeQU74q/7l44t7CrFSc+d1R4HxvKV5fYvOscp+vvjSaKKITXOSF0WOc/0Fku5JZ/7AMksupxhsJLoJxfP7q/zWmnHGRct7V+Q5w1rSofw+6kRpWrxw2dBNFeln8kk2QIa1lVKkYAzdAeibidFT0JOg8xLXOfgLjAU+VY/od8fsYb0RNrgglBh3eX1GmMrzjDBJlJK25qtlWjzSKtbS57McQ== 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=tmpAlmvABhKVF0pnMV+eps0gtMce+GwvLpsYb9H3Q9k=; b=JhJyG64GpYdCQhLVIM0qsYPWjQq+UqnH+zKntqUdUjkuKMg9KXzISiyUq3sPv3lGp79tgKR7SsYTY2Sysr9Hgg+AVCMNaFtjjTK8H1qBpefvB9xYUute81+0aL83x+TUyESeIHBqAMHWxI1gPqi3LKEWu2Hl53eziDh09bZSIjn4vZbeHl7zfQ4RqHpo1GUvqGRxcKkDaKK0LPEMhsaVrUOdx6wlL0M2pNCAAq8nn2d+Icrn0i12vinfd7y2j2lKEHqW8YNtRPIa5FxPC8J6N8/KbS73UzN/6gyFrhwcLjEQTUnQZcLB3rJ2hohTyQf3606kVJ/wf/RTzdlAQapPCw== 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 SJ0PR10MB4461.namprd10.prod.outlook.com (2603:10b6:a03:2d8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Thu, 8 Jun 2023 04:49:47 +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.6455.028; Thu, 8 Jun 2023 04:49:47 +0000 To: binutils@sourceware.org Cc: Indu Bhagat Subject: [PATCH 1/2] libsframe: update the semantics of sframe_fre_get_ra_offset Date: Wed, 7 Jun 2023 21:49:34 -0700 Message-Id: <20230608044935.4183325-2-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230608044935.4183325-1-indu.bhagat@oracle.com> References: <20230608044935.4183325-1-indu.bhagat@oracle.com> X-ClientProxiedBy: MW4PR04CA0208.namprd04.prod.outlook.com (2603:10b6:303:86::33) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|SJ0PR10MB4461:EE_ X-MS-Office365-Filtering-Correlation-Id: 1eb000ca-0b7c-4091-1362-08db67dbc8ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MTWhBvvhORALXGmAHUMjGd8sIDVRYyuyjM10Ck4TQieAdSHLZtbQfzRx/a+13P6cJ4LkNSyjQ2YS0eByAdjD6r16/WIlFjQ/VsSLpiuUoLdfpPBXMUnw8ueFlNvKTcpHZZUkoPdZ5cjKyd5gb83iSp/mypOpB0afQtPL5ox3Z7kl0Qfm/0bPMmTEskBRWVfhC5/xmxXtjPvk+5Ik3SvtYFx7OC0QE15BI0uM5EBJqlH7lMNrN9Tfs07PHSMH6JV9Ui8Pw6JBo3DIGQ7rFXa4sz2xoNUE+Z4TU73A1QCcvypL1nETk00ThpoOjqAuT2iecjBIflLllrF6q3BaE/etgjrUScw6Z6ZGBqkyuS2juEeWQ7iAmg9cR0iY6w66olSzD2qfpSxe5NQsOO9weV6fWiBT/Ly11u7RmEXV0KhjiJJbre/LbWRdvSXbrK+tkwP76aSWv1MaE2AdzfHnndBFrKJ7Gm9yD9buyZpjzgbW4VcyQ+OiBVGea70pPL2b5ObYKxxla1gIzBW+G19e8Sso4vEEpmOnHLiUOy2xIc5WU7O0Hr5D/4l/pOmuvuBdibHK 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)(136003)(39860400002)(346002)(366004)(376002)(396003)(451199021)(6486002)(478600001)(6666004)(36756003)(2616005)(186003)(38100700002)(86362001)(83380400001)(26005)(6512007)(1076003)(6506007)(107886003)(8936002)(5660300002)(8676002)(41300700001)(44832011)(2906002)(316002)(4326008)(6916009)(66556008)(66476007)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nJwbh1/O/TKDj4vFpiZ2SsF9aT6onlxEi8VnESMDHgVYCnI1WPAGj6J7ttDN84poT6S8hbZEKmESugONyc2U20x+FGFe0Ywbxr7GfIOeA1g44D7v4hRJCCGATW9XLqTqa8DVu0SA27LRkUe7ovwWq1zZOM8ar+iOkunua5ysiPK0zGiK677L7GHAJ1MD0uc/KAgZgklEmjHVfWkNiFCdVlhx/e3ByjmUZhnlFehf5W76n5DzU0NmNx5x6jK93juAhuvK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LsyUopcJklf/hUOOxKIrEoKVYXbC0GVyl7RveQ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1eb000ca-0b7c-4091-1362-08db67dbc8ec X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2023 04:49:47.0730 (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: XemlP/I9QbkcH3rjll/crUOgPyjmVaO3xNw024ga0fYU1MKBdIXYb1O5JF8I7ItVV3qGugkfSM2AtmiCFRVeXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4461 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-08_02,2023-06-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 suspectscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306080038 X-Proofpoint-ORIG-GUID: OOvXtxoNr2i9swovqXbuuM46ozLL06LG X-Proofpoint-GUID: OOvXtxoNr2i9swovqXbuuM46ozLL06LG 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?1768108653786651822?= X-GMAIL-MSGID: =?utf-8?q?1768108653786651822?= 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. This patch changes the behavior of sframe_fre_get_ra_offset: it turns an error into non-error. This change is deemed a compatible ABI change, because it should not break consumers unless they were relying on the error; the latter seems unlikely. Hence, this change of semantics does not require symbol versioning to accompany. 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 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 a5f4a7f6519..8d9d194a8a8 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);