From 852bb8c10de8abef79f0771dca879ddc8e4298b3 Mon Sep 17 00:00:00 2001 From: Indu Bhagat Date: Tue, 27 Jun 2023 11:53:40 -0700 Subject: libsframe: remove sframe_get_funcdesc_with_addr API 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. --- libsframe/sframe.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'libsframe') diff --git a/libsframe/sframe.c b/libsframe/sframe.c index 7308a45..8837f87 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); -- cgit v1.1