From bdd8d74d2f44fd705b49f8adf97de21ccb00a9ca Mon Sep 17 00:00:00 2001 From: Indu Bhagat Date: Thu, 25 Apr 2024 09:37:28 -0700 Subject: testsuite: minor housekeeping Fix some code formatting nits. libsframe/testsuite/ * libsframe.stacktrace/libsframest/sframe-stacktrace-err.c: * libsframe.stacktrace/libsframest/sframe-stacktrace.c: * libsframe.stacktrace/libsframest/sframe-state.c: * libsframe.stacktrace/libsframest/sframe-state.h: * libsframe.stacktrace/stacktrace-inline-2.c: --- .../libsframest/sframe-stacktrace-err.c | 3 +-- .../libsframest/sframe-stacktrace.c | 4 ++-- .../libsframest/sframe-state.c | 24 +++++++++++----------- .../libsframest/sframe-state.h | 13 ++++++------ .../libsframe.stacktrace/stacktrace-inline-2.c | 5 ++--- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace-err.c b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace-err.c index 4f64b4d..275ca33 100644 --- a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace-err.c +++ b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace-err.c @@ -49,7 +49,7 @@ sframe_bt_errmsg (enum sframe_bt_errcode ecode) return sframe_bt_errlist[ecode]; } -/* sframe_bt_errno - Check if there is error code in ERRP. */ +/* Check if there is error code in ERRP. */ int sframe_bt_errno (const int *errp) @@ -68,4 +68,3 @@ sframe_bt_ret_set_errno (int *errp, int error) return error; } - diff --git a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c index 521c86f..fbd001b 100644 --- a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c +++ b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-stacktrace.c @@ -123,8 +123,8 @@ sframe_unwind (struct sframe_state *sf, void **ra_lst, if (errnum == SFRAME_ERR_FREOFFSET_NOPRESENT) return sframe_bt_ret_set_errno (&err, SFRAME_BT_ERR_CFA_OFFSET); - cfa = ((frep->fre_info & 0x1) == SFRAME_BASE_REG_SP - ? rsp : rfp) + cfa_offset; + 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 diff --git a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.c b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.c index bb78c1a..1d0ae08 100644 --- a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.c +++ b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.c @@ -80,7 +80,7 @@ sframe_bt_set_errno (int *errp, int error) #endif -/* sframe_add_dso - Add .sframe info in D_DATA, which is associated with +/* Add .sframe info in D_DATA, which is associated with a dynamic shared object, to D_LIST. */ static int @@ -118,7 +118,7 @@ sframe_add_dso (struct sframe_stinfo_list *d_list, return SFRAME_BT_OK; } -/* sframe_free_cfi - Free up space allocated for .sframe info for CF. */ +/* Free up space allocated for .sframe info for CF. */ void sframe_free_cfi (struct sframe_state *sf) @@ -146,7 +146,7 @@ sframe_free_cfi (struct sframe_state *sf) free (d_list->entry); } -/* sframe_find_context - Find the decode data that contains ADDR from CF. +/* Find the decode data that contains ADDR from CF. Return the pointer to the decode data or NULL. */ struct sframe_stinfo * @@ -175,9 +175,9 @@ sframe_find_context (struct sframe_state *sf, uint64_t addr) return NULL; } -/* sframe_load_ctx - Call decoder to create and set up the SFrame info for - either the main module or one of the DSOs from CF, based on the input - RADDR argument. Return the newly created decode context or NULL. */ +/* Call decoder to create and set up the SFrame info for either the main module + or one of the DSOs from CF, based on the input RADDR argument. Return the + newly created decode context or NULL. */ sframe_decoder_ctx * sframe_load_ctx (struct sframe_state *sf, uint64_t raddr) @@ -205,10 +205,10 @@ sframe_load_ctx (struct sframe_state *sf, uint64_t raddr) return NULL; } -/* sframe_update_ctx - Check if need to do a decode context switch, based on - the input RADDR argument, from CF. A new decode context will be created - and set up if it isn't already done so. Return the new decode context in - CTX and vma in CFI_VMA. */ +/* Check if need to do a decode context switch, based on the input RADDR + argument, from CF. A new decode context will be created and set up if it + isn't already done so. Return the new decode context in CTX and vma in + CFI_VMA. */ void sframe_update_ctx (struct sframe_state *sf, uint64_t raddr, @@ -236,8 +236,8 @@ sframe_update_ctx (struct sframe_state *sf, uint64_t raddr, } } -/* sframe_fd_open - Open /proc image associated with the process id and return - the file descriptor. */ +/* Open /proc image associated with the process id and return the file + descriptor. */ static int sframe_fd_open (int *errp) diff --git a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.h b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.h index 9795411..98c91f6 100644 --- a/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.h +++ b/libsframe/testsuite/libsframe.stacktrace/libsframest/sframe-state.h @@ -38,8 +38,9 @@ #include "sframe-stacktrace-api.h" #include "sframe-stacktrace-regs.h" +/* glibc's elf.h will bring this in future. */ #ifndef PT_SFRAME -#define PT_SFRAME 0x6474e554 /* FIXME. */ +#define PT_SFRAME 0x6474e554 #endif /* SFrame decode data for the main module or a DSO. */ @@ -58,15 +59,15 @@ struct sframe_stinfo_list { int alloced; /* Entries allocated. */ int used; /* Entries used. */ - struct sframe_stinfo *entry; /* DSO's decode data. */ + struct sframe_stinfo *entry; /* DSO's decode data. */ }; /* Data that's passed through sframe_callback. */ struct sframe_state { int sui_fd; /* File descriptor. */ - struct sframe_stinfo sui_ctx; /* The decode data. */ - struct sframe_stinfo_list sui_dsos; /* The DSO list. */ + struct sframe_stinfo sui_ctx; /* The decode data. */ + struct sframe_stinfo_list sui_dsos; /* The DSO list. */ }; @@ -81,8 +82,8 @@ void sframe_update_ctx (struct sframe_state *sf, uint64_t raddr, sframe_decoder_ctx *sframe_load_ctx (struct sframe_state *sf, uint64_t raddr); -struct sframe_stinfo * -sframe_find_context (struct sframe_state *sf, uint64_t addr); +struct sframe_stinfo *sframe_find_context (struct sframe_state *sf, + uint64_t addr); void sframe_free_cfi (struct sframe_state *sf); diff --git a/libsframe/testsuite/libsframe.stacktrace/stacktrace-inline-2.c b/libsframe/testsuite/libsframe.stacktrace/stacktrace-inline-2.c index 3b0ee91..28d2ae0 100644 --- a/libsframe/testsuite/libsframe.stacktrace/stacktrace-inline-2.c +++ b/libsframe/testsuite/libsframe.stacktrace/stacktrace-inline-2.c @@ -13,12 +13,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +/* This is a revised version of gdb/testsuite/gdb.opt/inline-cmds.c. */ + /* This is only ever run if it is compiled with a new-enough GCC, but we don't want the compilation to fail if compiled by some other compiler. */ - -/* This is a revised version of gdb/testsuite/gdb.opt/inline-cmds.c. */ - #ifdef __GNUC__ #define ATTR __attribute__((always_inline)) #else -- cgit v1.1