From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 9AE7A3858C60 for ; Wed, 2 Nov 2022 16:15:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9AE7A3858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 357B5340DCA; Wed, 2 Nov 2022 16:15:19 +0000 (UTC) Date: Wed, 2 Nov 2022 20:45:59 +0545 From: Mike Frysinger To: Weimin Pan Cc: binutils@sourceware.org Subject: Re: [PATCH, V3 08/15] unwinder: generate backtrace using SFrame format Message-ID: Mail-Followup-To: Weimin Pan , binutils@sourceware.org References: <20221030074450.1956074-1-indu.bhagat@oracle.com> <20221030074450.1956074-9-indu.bhagat@oracle.com> <34f06d43-3db9-b16d-95e4-805c24ad258a@oracle.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HkcMwxWppqItXCL8" Content-Disposition: inline In-Reply-To: <34f06d43-3db9-b16d-95e4-805c24ad258a@oracle.com> X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --HkcMwxWppqItXCL8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 01 Nov 2022 15:36, Weimin Pan via Binutils wrote: > On 10/30/2022 7:03 AM, Mike Frysinger via Binutils wrote: > > On 30 Oct 2022 00:44, Indu Bhagat via Binutils wrote: > >> +static void > >> +sframe_unwind (struct sframe_unwind_info *sf, void **ra_lst, > >> + int *ra_size, int *errp) > >> +{ > >> ... > >> +#ifdef __x86_64__ > > this really needs better delegation for porting than inlined in the mid= dle > > of a large portable file. can you at least factor it out into a header= ? >=20 > Sorry, not sure I follow this comment. Would you please elaborate on=20 > "factoring it out into a header"? common code like this should not be stuffed with arch-specific checks and implementations. it makes it hard for more ports to happen, and for code to be checked/validated. further, as-written, this code can only be run on a system with a matching runtime architecture. normally a library that is meant for processing of files is host-agnostic. that's like the whole design of libbfd and other tools in the binutils project. i don't know how important that use case is to this particular bit of code though. to at least address the code health, create an API between the common code and the arch-specific code, and then add arch-specific files that implement that API. it could be a header of small inline functions. for the host-agnostic part, i haven't really read the library API to make suggestions for how to address it. libbfd takes objects/arches as arguments and then operates according to those. -mike --HkcMwxWppqItXCL8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNihisACgkQQWM7n+g3 9YFqFg//UxuU3TgIHwwre++12T3C+fwYOFv/Od5GP4YeKKoMdhOWNW+OpHRCYFm8 tgoFhjXj9PkRiQmC13h38goKFvz9VjpXpcQfNd/8BP0WL/V8VVbC+irVgZncbQr0 vSti6LgLNsslIYgHtD/JgyvEd29NEgKkRunVvhYu/zlqM8GFv+TKtAjOHnoARz34 EoyBdjdcPWs2n1dRtBnG5XX4xr/HhsQH343xTpTJRERllhRW6RoGo7f4OYaDdBKX GtF/7VAwgMKb0P7AvyJVJ54icRfG8vi09iQ6esGVZ0qqqyOWn5GolciUyNPOslyh 0DW5Y2I0r0KYeDRGIxyHQYg8E/kXSpwuNoM3eyIRphg603plQA7dk8bESC5AD/MN soFLn5i2abHE4vdEVv6O6DVayRl/9hs0t7MtvawuRpAYY6JPV9jw0Y+7p8qrbTpP gChdMtY6h90wARA39w9doJiE28BoW/M3p5G8Fdlbw+LSHeunpHaxWxwZxvmoiNw+ 4UqkdBTyRd17BXT2RqeqwK3UcUfKLi4jpwpiUuhu+YM7Anwr3ZMUCWvV4hmwR3BO B1g/G1bgZsLI69tmUmEqWvWMUh9tm/TzsvsjHBQ2YCdDRA1/KBfrutkcfumM96+X /9jiz/dh/8m1dv8BUXJdRVoNiuibdISd/IP49fEn5ZB80ap7V+U= =RmRS -----END PGP SIGNATURE----- --HkcMwxWppqItXCL8--