public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <ibhagat@sourceware.org>
To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org
Subject: [binutils-gdb] libsframe: fix sframe_find_fre for pltN entries
Date: Fri,  9 Jun 2023 18:48:10 +0000 (GMT)	[thread overview]
Message-ID: <20230609184810.B0D923858D35@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=937c461e41b866fc26d0c4ac6973ee3923267aab

commit 937c461e41b866fc26d0c4ac6973ee3923267aab
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date:   Fri Jun 9 11:14:05 2023 -0700

    libsframe: fix sframe_find_fre for pltN entries
    
    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.

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 == 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;

             reply	other threads:[~2023-06-09 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 18:48 Indu Bhagat [this message]
2023-06-29 18:13 Indu Bhagat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230609184810.B0D923858D35@sourceware.org \
    --to=ibhagat@sourceware.org \
    --cc=bfd-cvs@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).