diff options
author | Indu Bhagat <indu.bhagat@oracle.com> | 2024-04-25 13:25:33 -0700 |
---|---|---|
committer | Indu Bhagat <indu.bhagat@oracle.com> | 2024-04-25 15:03:50 -0700 |
commit | e47e027d6ce9d71d356d6183558713f6aed8212d (patch) | |
tree | 4a39f89a5a2fe3899f36be8a2c07aba29c83cef4 | |
parent | bdd8d74d2f44fd705b49f8adf97de21ccb00a9ca (diff) | |
download | gdb-e47e027d6ce9d71d356d6183558713f6aed8212d.zip gdb-e47e027d6ce9d71d356d6183558713f6aed8212d.tar.gz gdb-e47e027d6ce9d71d356d6183558713f6aed8212d.tar.bz2 |
lisbframest: remove unnecessary arch-specific code
ChangeLog:
* libsframe/testsuite/libsframe.stacktrace/libsframest
/sframe-stacktrace.c (sframe_unwind): Remove unnecessary guards
and arch-specific handling.
-rw-r--r-- | libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c index fbd001b..c15c329 100644 --- a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c +++ b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c @@ -85,9 +85,8 @@ sframe_unwind (struct sframe_state *sf, void **ra_lst, int *ra_size) { uint64_t cfa, return_addr, ra_stack_loc, rfp_stack_loc; - int8_t fixed_ra_offset; sframe_decoder_ctx *ctx; - int cfa_offset, rfp_offset, errnum, i, count; + int cfa_offset, rfp_offset, ra_offset, errnum, i, count; sframe_frame_row_entry fred, *frep = &fred; uint64_t pc, rfp, rsp, ra, cfi_vma; ucontext_t context, *cp = &context; @@ -105,6 +104,8 @@ sframe_unwind (struct sframe_state *sf, void **ra_lst, rfp = get_context_rfp (cp); ra = get_context_ra (cp); + return_addr = ra; + /* Load and set up the decoder. */ ctx = sframe_load_ctx (sf, pc); if (ctx == NULL) @@ -126,20 +127,7 @@ sframe_unwind (struct sframe_state *sf, void **ra_lst, cfa = (((frep->fre_info & 0x1) == SFRAME_BASE_REG_SP) ? rsp : rfp) + cfa_offset; -#ifdef __x86_64__ - /* For x86, read the return address from the fixed RA offset from - the SFrame header. RA must be at location CFA - 8. */ - fixed_ra_offset = sframe_decoder_get_fixed_ra_offset (ctx); - if (fixed_ra_offset == SFRAME_CFA_FIXED_RA_INVALID) - return sframe_bt_ret_set_errno (&err, SFRAME_BT_ERR_FRE_INVAL); - - ra_stack_loc = cfa + fixed_ra_offset; - errnum = get_contents_8b (sf->sui_fd, ra_stack_loc, &return_addr); - if (sframe_bt_errno (&errnum)) - return sframe_bt_ret_set_errno (&err, SFRAME_BT_ERR_FRE_INVAL); -#else -#ifdef __aarch64__ - int ra_offset = sframe_fre_get_ra_offset (ctx, frep, &errnum); + ra_offset = sframe_fre_get_ra_offset (ctx, frep, &errnum); if (errnum == 0) { ra_stack_loc = cfa + ra_offset; @@ -147,10 +135,6 @@ sframe_unwind (struct sframe_state *sf, void **ra_lst, if (sframe_bt_errno (&errnum)) return sframe_bt_ret_set_errno (&err, SFRAME_BT_ERR_FRE_INVAL); } - else - return_addr = ra; -#endif -#endif /* Validate and add return address to the list. */ if (sframe_valid_addr_p (sf, return_addr) == 0) |