public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: binutils@sourceware.org
Cc: Indu Bhagat <indu.bhagat@oracle.com>
Subject: [COMMITTED] libsframe: remove sframe_get_funcdesc_with_addr API
Date: Tue, 27 Jun 2023 12:51:16 -0700	[thread overview]
Message-ID: <20230627195126.1955051-2-indu.bhagat@oracle.com> (raw)
In-Reply-To: <20230627195126.1955051-1-indu.bhagat@oracle.com>

This is an incompatible ABI change in libsframe.

The interface provided by this function is not a healthy abstraction to
expose: the return type sframe_func_desc_entry, which is defined in
include/sframe.h (the SFrame binary format definition).  This ties up
the library in a undesirable way.  Most importantly, this function
should technically not be directly necessary for a stack tracer.  A
stack tracer will likely only need to do a sframe_find_fre ().

Rename the API to continue to use the functionality internally in the
library.  bfd/linker does not use this function.

Change the return type of the previous definition and make a note about
its planned deprecation.

include/
	* sframe-api.h:  Change return type of sframe_get_funcdesc_with_addr.
	Add comment for intention to deprecate.
libsframe/
	*sframe.c (sframe_get_funcdesc_with_addr): Change return type
	and set error code. This API is deprecated.
        (sframe_get_funcdesc_with_addr_internal): New definition for
	internal use.
	(sframe_find_fre): Use sframe_get_funcdesc_with_addr_internal
	instead.
---
 include/sframe-api.h | 11 +++++++----
 libsframe/sframe.c   | 20 ++++++++++++++++----
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/include/sframe-api.h b/include/sframe-api.h
index df1f5ccef4c..a00303a3598 100644
--- a/include/sframe-api.h
+++ b/include/sframe-api.h
@@ -133,10 +133,13 @@ sframe_decoder_get_fixed_fp_offset (sframe_decoder_ctx *dctx);
 extern int8_t
 sframe_decoder_get_fixed_ra_offset (sframe_decoder_ctx *dctx);
 
-/* Find the function descriptor entry which contains the specified address.  */
-extern sframe_func_desc_entry *
-sframe_get_funcdesc_with_addr (sframe_decoder_ctx *dctx,
-			       int32_t addr, int *errp);
+/* Find the function descriptor entry which contains the specified address.
+
+   Note: This function is deprecated and will be removed from future release
+   X+2 of the library.  */
+extern void *
+sframe_get_funcdesc_with_addr (sframe_decoder_ctx *dctx, int32_t addr,
+			       int *errp);
 
 /* Find the SFrame Frame Row Entry which contains the PC.  Returns
    SFRAME_ERR if failure.  */
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 7308a45ce88..8837f878fb0 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -950,12 +950,24 @@ sframe_decoder_get_fixed_ra_offset (sframe_decoder_ctx *ctx)
   return dhp->sfh_cfa_fixed_ra_offset;
 }
 
+/* Find the function descriptor entry which contains the specified address
+   ADDR.
+   This function is deprecated and will be removed from libsframe.so.2.  */
+
+void *
+sframe_get_funcdesc_with_addr (sframe_decoder_ctx *ctx __attribute__ ((unused)),
+			       int32_t addr __attribute__ ((unused)),
+			       int *errp)
+{
+  return sframe_ret_set_errno (errp, SFRAME_ERR_INVAL);
+}
+
 /* Find the function descriptor entry starting which contains the specified
    address ADDR.  */
 
-sframe_func_desc_entry *
-sframe_get_funcdesc_with_addr (sframe_decoder_ctx *ctx,
-			       int32_t addr, int *errp)
+static sframe_func_desc_entry *
+sframe_get_funcdesc_with_addr_internal (sframe_decoder_ctx *ctx, int32_t addr,
+					int *errp)
 {
   sframe_header *dhp;
   sframe_func_desc_entry *fdp;
@@ -1053,7 +1065,7 @@ sframe_find_fre (sframe_decoder_ctx *ctx, int32_t pc,
     return sframe_set_errno (&err, SFRAME_ERR_INVAL);
 
   /* Find the FDE which contains the PC, then scan its fre entries.  */
-  fdep = sframe_get_funcdesc_with_addr (ctx, pc, &err);
+  fdep = sframe_get_funcdesc_with_addr_internal (ctx, pc, &err);
   if (fdep == NULL || ctx->sfd_fres == NULL)
     return sframe_set_errno (&err, SFRAME_ERR_DCTX_INVAL);
 
-- 
2.39.2


  reply	other threads:[~2023-06-27 19:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 19:51 [COMMITTED] libsframe: add library versioning Indu Bhagat
2023-06-27 19:51 ` Indu Bhagat [this message]
2023-06-27 19:51 ` [COMMITTED] libsframe: add symbol versioning Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: update the semantics of sframe_fre_get_ra_offset Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: update the semantics of sframe_fre_get_fp_offset Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: use uint32_t for fre_type and fde_type function args Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: bfd: use uint32_t for return type of sframe_calc_fre_type Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: use uint8_t instead of unsigned char for abi_arch Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: use uint8_t for return type of sframe_fre_get_base_reg_id Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: use appropriate data types for args of sframe_encode Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: bfd: use uint32_t for return type of get_num_fidx APIs Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] binutils/NEWS: add note about upcoming libsframe changes 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=20230627195126.1955051-2-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=binutils@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).