public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] libsframe: fix sframe_find_fre for pltN entries
@ 2023-06-09 19:28 Indu Bhagat
  2023-06-09 19:28 ` [COMMITTED] libsframe: testsuite: add sframe_find_fre tests " Indu Bhagat
  0 siblings, 1 reply; 2+ messages in thread
From: Indu Bhagat @ 2023-06-09 19:28 UTC (permalink / raw)
  To: binutils; +Cc: Indu Bhagat

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) >= (pc & 0xff), etc.

This is buggy and needs correction.  The mask 0xff should be 0xf (to
work for a pltN entry of size say, 16 bytes).

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.

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.

libsframe/
	* sframe.c (sframe_find_fre): Correct the bitmask used for
	SFrame FDEs of type SFRAME_FDE_TYPE_PCMASK.
---
 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 == SFRAME_FDE_TYPE_PCMASK)
-    bitmask = 0xff;
+    bitmask = 0xf;
 
   fres = ctx->sfd_fres + fdep->sfde_func_start_fre_off;
   func_start_addr = fdep->sfde_func_start_address;
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-09 19:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 19:28 [COMMITTED] libsframe: fix sframe_find_fre for pltN entries Indu Bhagat
2023-06-09 19:28 ` [COMMITTED] libsframe: testsuite: add sframe_find_fre tests " Indu Bhagat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).