From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7850) id B0D923858D35; Fri, 9 Jun 2023 18:48:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0D923858D35 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Indu Bhagat To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] libsframe: fix sframe_find_fre for pltN entries X-Act-Checkin: binutils-gdb X-Git-Author: Indu Bhagat X-Git-Refname: refs/heads/master X-Git-Oldrev: 05d63bafad71b534c041275831489f3e0dedcf3f X-Git-Newrev: 937c461e41b866fc26d0c4ac6973ee3923267aab Message-Id: <20230609184810.B0D923858D35@sourceware.org> Date: Fri, 9 Jun 2023 18:48:10 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jun 2023 18:48:10 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D937c461e41b8= 66fc26d0c4ac6973ee3923267aab commit 937c461e41b866fc26d0c4ac6973ee3923267aab Author: Indu Bhagat Date: Fri Jun 9 11:14:05 2023 -0700 libsframe: fix sframe_find_fre for pltN entries =20 To find SFrame stack trace information from an FDE of type SFRAME_FDE_TYPE_PCMASK, sframe_find_fre () was doing an operation like, (start_ip_offset & 0xff) >=3D (pc & 0xff), etc. =20 This is buggy and needs correction. The mask 0xff should be 0xf (to work for a pltN entry of size say, 16 bytes). =20 At this time, the size of the pltN entry is implicitly assumed to be 16 bytes by libsframe. In next version of the SFrame format, we can encode this information explicitly in the SFrame FDE. =20 For now, we should fix the code to at least behave correctly for the generated code and the generated SFrame stack trace information for the pltN entries on x86_64. =20 libsframe/ * sframe.c (sframe_find_fre): Correct the bitmask used for SFrame FDEs of type SFRAME_FDE_TYPE_PCMASK. Diff: --- libsframe/sframe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsframe/sframe.c b/libsframe/sframe.c index a5f4a7f6519..7308a45ce88 100644 --- a/libsframe/sframe.c +++ b/libsframe/sframe.c @@ -1066,7 +1066,7 @@ sframe_find_fre (sframe_decoder_ctx *ctx, int32_t pc, /* FIXME - the bitmask should be picked per ABI or encoded in the format somehow. For AMD64, the pltN entry stub is 16 bytes. */ if (fde_type =3D=3D SFRAME_FDE_TYPE_PCMASK) - bitmask =3D 0xff; + bitmask =3D 0xf; =20 fres =3D ctx->sfd_fres + fdep->sfde_func_start_fre_off; func_start_addr =3D fdep->sfde_func_start_address;