From 5dc4ff35068e1c40743969f63b82865af162b6f6 Mon Sep 17 00:00:00 2001 From: Abhijit Ray Chaudhury Date: Wed, 28 Feb 2024 19:08:58 +0530 Subject: [PATCH 1/2] Add VDSO support to libunwind , port the patch from https://sourceware.org/pipermail/frysk-cvs/2008q1/007245.html --- doc/unw_get_proc_name_by_ip.man | 4 +- include/tdep-aarch64/libunwind_i.h | 5 +- include/tdep-arm/libunwind_i.h | 5 +- include/tdep-hppa/libunwind_i.h | 5 +- include/tdep-ia64/libunwind_i.h | 5 +- include/tdep-loongarch64/libunwind_i.h | 5 +- include/tdep-mips/libunwind_i.h | 5 +- include/tdep-ppc32/libunwind_i.h | 5 +- include/tdep-ppc64/libunwind_i.h | 5 +- include/tdep-riscv/libunwind_i.h | 5 +- include/tdep-s390x/libunwind_i.h | 5 +- include/tdep-sh/libunwind_i.h | 5 +- include/tdep-x86/libunwind_i.h | 5 +- include/tdep-x86_64/libunwind_i.h | 5 +- src/aarch64/Ginit.c | 4 +- src/arm/Ginit.c | 2 +- src/elfxx.c | 12 +-- src/elfxx.h | 6 +- src/hppa/Ginit.c | 2 +- src/ia64/Ginit.c | 2 +- src/nto/unw_nto_find_proc_info.c | 2 +- src/os-freebsd.c | 4 +- src/os-hpux.c | 4 +- src/os-linux.c | 105 ++++++++++++++++++++++++- src/os-qnx.c | 4 +- src/os-solaris.c | 4 +- src/ppc32/Ginit.c | 2 +- src/ppc64/Ginit.c | 2 +- src/ptrace/_UPT_find_proc_info.c | 8 +- src/ptrace/_UPT_get_elf_filename.c | 4 +- src/ptrace/_UPT_get_proc_name.c | 4 +- src/s390x/Ginit.c | 2 +- src/sh/Ginit.c | 2 +- src/x86/Ginit.c | 4 +- src/x86_64/Ginit.c | 4 +- 35 files changed, 183 insertions(+), 69 deletions(-) diff --git a/doc/unw_get_proc_name_by_ip.man b/doc/unw_get_proc_name_by_ip.man index 4537f261d..c15ab5e58 100644 --- a/doc/unw_get_proc_name_by_ip.man +++ b/doc/unw_get_proc_name_by_ip.man @@ -1,7 +1,7 @@ .\" *********************************** start of \input{common.tex} .\" *********************************** end of \input{common.tex} '\" t -.\" Manual page created with latex2man on Tue Aug 29 12:09:48 2023 +.\" Manual page created with latex2man on Fri Feb 23 11:27:29 2024 .\" NOTE: This file is generated, DO NOT EDIT. .de Vb .ft CW @@ -12,7 +12,7 @@ .fi .. -.TH "UNW\\_GET\\_PROC\\_NAME\\_BY\\_IP" "3libunwind" "29 August 2023" "Programming Library " "Programming Library " +.TH "UNW\\_GET\\_PROC\\_NAME\\_BY\\_IP" "3libunwind" "23 February 2024" "Programming Library " "Programming Library " .SH NAME unw_get_proc_name_by_ip \-\- get procedure name diff --git a/include/tdep-aarch64/libunwind_i.h b/include/tdep-aarch64/libunwind_i.h index ec1a2e91a..ef54c42eb 100644 --- a/include/tdep-aarch64/libunwind_i.h +++ b/include/tdep-aarch64/libunwind_i.h @@ -320,9 +320,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (unw_context_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, +- void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-arm/libunwind_i.h b/include/tdep-arm/libunwind_i.h index 35b13c79f..18ac526b2 100644 --- a/include/tdep-arm/libunwind_i.h +++ b/include/tdep-arm/libunwind_i.h @@ -310,9 +310,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-hppa/libunwind_i.h b/include/tdep-hppa/libunwind_i.h index 1b6757fb1..84ab6d193 100644 --- a/include/tdep-hppa/libunwind_i.h +++ b/include/tdep-hppa/libunwind_i.h @@ -267,9 +267,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-ia64/libunwind_i.h b/include/tdep-ia64/libunwind_i.h index 04ca58f51..be031ef1d 100644 --- a/include/tdep-ia64/libunwind_i.h +++ b/include/tdep-ia64/libunwind_i.h @@ -261,9 +261,10 @@ extern void tdep_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, unw_regnum_t regnum, uint8_t *nat_bitnr); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-loongarch64/libunwind_i.h b/include/tdep-loongarch64/libunwind_i.h index d21c92297..0f64cdaba 100644 --- a/include/tdep-loongarch64/libunwind_i.h +++ b/include/tdep-loongarch64/libunwind_i.h @@ -239,9 +239,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-mips/libunwind_i.h b/include/tdep-mips/libunwind_i.h index b0e623499..8fe6a4e41 100644 --- a/include/tdep-mips/libunwind_i.h +++ b/include/tdep-mips/libunwind_i.h @@ -327,9 +327,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-ppc32/libunwind_i.h b/include/tdep-ppc32/libunwind_i.h index 46d4f5a8e..3eda2a392 100644 --- a/include/tdep-ppc32/libunwind_i.h +++ b/include/tdep-ppc32/libunwind_i.h @@ -300,9 +300,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t * pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t * uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t * valp, int write); diff --git a/include/tdep-ppc64/libunwind_i.h b/include/tdep-ppc64/libunwind_i.h index a93d56931..aad954337 100644 --- a/include/tdep-ppc64/libunwind_i.h +++ b/include/tdep-ppc64/libunwind_i.h @@ -355,9 +355,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t * pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t * uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t * valp, int write); diff --git a/include/tdep-riscv/libunwind_i.h b/include/tdep-riscv/libunwind_i.h index 951de12a0..8f8d04ef1 100644 --- a/include/tdep-riscv/libunwind_i.h +++ b/include/tdep-riscv/libunwind_i.h @@ -290,9 +290,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-s390x/libunwind_i.h b/include/tdep-s390x/libunwind_i.h index a6af60c9c..d279022e5 100644 --- a/include/tdep-s390x/libunwind_i.h +++ b/include/tdep-s390x/libunwind_i.h @@ -248,9 +248,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen), + void *arg; extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-sh/libunwind_i.h b/include/tdep-sh/libunwind_i.h index 4f4a5cdd0..52ac3c309 100644 --- a/include/tdep-sh/libunwind_i.h +++ b/include/tdep-sh/libunwind_i.h @@ -268,9 +268,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-x86/libunwind_i.h b/include/tdep-x86/libunwind_i.h index 58e583c3b..dcbae69c8 100644 --- a/include/tdep-x86/libunwind_i.h +++ b/include/tdep-x86/libunwind_i.h @@ -262,9 +262,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-x86_64/libunwind_i.h b/include/tdep-x86_64/libunwind_i.h index 7ec16aafd..72514be19 100644 --- a/include/tdep-x86_64/libunwind_i.h +++ b/include/tdep-x86_64/libunwind_i.h @@ -275,9 +275,10 @@ extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di, unw_proc_info_t *pi, int need_unwind_info, void *arg); extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg); -extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + char *path, size_t pathlen, + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c index 6986dbb61..7ab4c824b 100644 --- a/src/aarch64/Ginit.c +++ b/src/aarch64/Ginit.c @@ -217,7 +217,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); } static unw_word_t empty_ptrauth_mask(unw_addr_space_t addr_space_unused, void *as_arg_unused) @@ -228,7 +228,7 @@ static unw_word_t empty_ptrauth_mask(unw_addr_space_t addr_space_unused, void *a static int get_static_elf_filename (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_elf_filename(as, getpid(), ip, buf, buf_len, offp); + return _Uelf64_get_elf_filename(as, getpid(), ip, buf, buf_len, offp,arg); } HIDDEN void diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c index 20071fd01..cfd440725 100644 --- a/src/arm/Ginit.c +++ b/src/arm/Ginit.c @@ -167,7 +167,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); } static int diff --git a/src/elfxx.c b/src/elfxx.c index e7b2d561f..dae3a2611 100644 --- a/src/elfxx.c +++ b/src/elfxx.c @@ -627,14 +627,14 @@ elf_w (get_proc_name_in_image) (unw_addr_space_t as, struct elf_image *ei, HIDDEN int elf_w (get_proc_name) (unw_addr_space_t as, pid_t pid, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp) + char *buf, size_t buf_len, unw_word_t *offp, void *arg) { unsigned long segbase, mapoff; struct elf_image ei; int ret; char file[PATH_MAX]; - ret = tdep_get_elf_image (&ei, pid, ip, &segbase, &mapoff, file, PATH_MAX); + ret = tdep_get_elf_image (as, &ei, pid, ip, &segbase, &mapoff, file, PATH_MAX,arg); if (ret < 0) return ret; @@ -687,14 +687,14 @@ elf_w (get_proc_ip_range_in_image) (unw_addr_space_t as, struct elf_image *ei, HIDDEN int elf_w (get_proc_ip_range) (unw_addr_space_t as, pid_t pid, unw_word_t ip, - unw_word_t *start, unw_word_t *end) + unw_word_t *start, unw_word_t *end, void *arg) { unsigned long segbase, mapoff; struct elf_image ei; int ret; char file[PATH_MAX]; - ret = tdep_get_elf_image (&ei, pid, ip, &segbase, &mapoff, file, PATH_MAX); + ret = tdep_get_elf_image (as, &ei, pid, ip, &segbase, &mapoff, file, PATH_MAX, arg); if (ret < 0) return ret; @@ -712,13 +712,13 @@ elf_w (get_proc_ip_range) (unw_addr_space_t as, pid_t pid, unw_word_t ip, HIDDEN int elf_w (get_elf_filename) (unw_addr_space_t as, pid_t pid, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp) + char *buf, size_t buf_len, unw_word_t *offp, void *arg) { unsigned long segbase, mapoff; int ret = UNW_ESUCCESS; // use NULL to no map elf image - ret = tdep_get_elf_image (NULL, pid, ip, &segbase, &mapoff, buf, buf_len); + ret = tdep_get_elf_image (as, NULL, pid, ip, &segbase, &mapoff, buf, buf_len, arg); if (ret < 0) return ret; diff --git a/src/elfxx.h b/src/elfxx.h index ad82d9be8..ee3677a72 100644 --- a/src/elfxx.h +++ b/src/elfxx.h @@ -45,7 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ extern int elf_w (get_proc_name) (unw_addr_space_t as, pid_t pid, unw_word_t ip, char *buf, size_t len, - unw_word_t *offp); + unw_word_t *offp, void *arg); extern int elf_w (get_proc_name_in_image) (unw_addr_space_t as, struct elf_image *ei, @@ -55,14 +55,14 @@ extern int elf_w (get_proc_name_in_image) (unw_addr_space_t as, extern int elf_w (get_proc_ip_range) (unw_addr_space_t as, pid_t pid, unw_word_t ip, - unw_word_t *start, unw_word_t *end); + unw_word_t *start, unw_word_t *end, void *arg); extern int elf_w (get_proc_ip_range_in_image) (unw_addr_space_t as, struct elf_image *ei, unsigned long segbase, unw_word_t ip, unw_word_t *start, unw_word_t *end); extern int elf_w (get_elf_filename) (unw_addr_space_t as, pid_t pid, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp); + char *buf, size_t buf_len, unw_word_t *offp, void *arg); extern Elf_W (Shdr)* elf_w (find_section) (const struct elf_image *ei, const char* secname); extern int elf_w (load_debuginfo) (const char* file, struct elf_image *ei, int is_local); diff --git a/src/hppa/Ginit.c b/src/hppa/Ginit.c index 5f06b17f7..694b60030 100644 --- a/src/hppa/Ginit.c +++ b/src/hppa/Ginit.c @@ -171,7 +171,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int diff --git a/src/ia64/Ginit.c b/src/ia64/Ginit.c index 91750bee0..6a03f7cf4 100644 --- a/src/ia64/Ginit.c +++ b/src/ia64/Ginit.c @@ -349,7 +349,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int diff --git a/src/nto/unw_nto_find_proc_info.c b/src/nto/unw_nto_find_proc_info.c index a3fd115fe..870c08cdd 100644 --- a/src/nto/unw_nto_find_proc_info.c +++ b/src/nto/unw_nto_find_proc_info.c @@ -75,7 +75,7 @@ int unw_nto_find_proc_info (unw_addr_space_t as, &segbase, &mapoff, path, - sizeof (path)); + sizeof (path),arg); if (ret >= 0) { diff --git a/src/os-freebsd.c b/src/os-freebsd.c index 0767e4ef4..36a30e9e6 100644 --- a/src/os-freebsd.c +++ b/src/os-freebsd.c @@ -89,8 +89,8 @@ get_pid_by_tid(int tid) } int -tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen) +tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, void *arg) { int mib[4], error, ret; size_t len, len1; diff --git a/src/os-hpux.c b/src/os-hpux.c index 7b8a2313c..4b4662819 100644 --- a/src/os-hpux.c +++ b/src/os-hpux.c @@ -32,9 +32,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "elf64.h" HIDDEN int -tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen) + char *path, size_t pathlen, void *arg) { struct load_module_desc lmd; const char *path2; diff --git a/src/os-linux.c b/src/os-linux.c index b47abc394..648d203f0 100644 --- a/src/os-linux.c +++ b/src/os-linux.c @@ -33,10 +33,21 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" #include "os-linux.h" +#ifndef MAX_VDSO_SIZE +/*Dont know what is the Max Size in my system it was 8192 or twice the page size*/ +# define MAX_VDSO_SIZE ((size_t) 2 * sysconf (_SC_PAGESIZE)) +#endif + +#ifndef MAP_32BIT +# define MAP_32BIT 0 +#endif + + int -tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen) + char *path, size_t pathlen, + void *arg) { struct map_iterator mi; int found = 0, rc = UNW_ESUCCESS; @@ -44,6 +55,9 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, char root[sizeof ("/proc/0123456789/root")], *cp; char *full_path; struct stat st; + unw_accessors_t *a; + unw_word_t magic; + if (maps_init (&mi, pid) < 0) return -1; @@ -104,6 +118,93 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, rc = elf_map_image (ei, full_path); + /*Follwing code is adapted from + https://sourceware.org/pipermail/frysk-cvs/2008q1/007245.html, + For VDSO there is no file in the file system, so read the ELF , + and create mmaped file for the content of the VDSO + */ + if (rc != -1) + { + maps_close (&mi); + goto err_exit; + } + + /* If the above failed, try to bring in page-sized segments directly + from process memory. This enables us to locate VDSO unwind + tables. */ + ei->size = hi - *segbase; + if (ei->size > MAX_VDSO_SIZE) + { + maps_close (&mi); + goto err_exit; + } + + a = unw_get_accessors (as); + if (! a->access_mem) + { + maps_close (&mi); + goto err_exit; + } + + /* Try to decide whether it's an ELF image before bringing it all + in. */ + if (ei->size <= EI_CLASS || ei->size <= sizeof (magic)) + { + maps_close (&mi); + goto err_exit; + } + + if (sizeof (magic) >= SELFMAG) + { + int ret = (*a->access_mem) (as, *segbase, &magic, 0, arg); + if (ret < 0) + { + rc = ret; + maps_close (&mi); + goto err_exit; + } + + if (memcmp (&magic, ELFMAG, SELFMAG) != 0) + { + maps_close (&mi); + goto err_exit; + } + } + + ei->image = mmap (0, ei->size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0); + if (ei->image == MAP_FAILED) + { + maps_close (&mi); + goto err_exit; + } + + if (sizeof (magic) >= SELFMAG) + { + *(unw_word_t *)ei->image = magic; + hi = sizeof (magic); + } + else + hi = 0; + + for (; hi < ei->size; hi += sizeof (unw_word_t)) + { + rc = (*a->access_mem) (as, *segbase + hi, ei->image + hi, + 0, arg); + if (rc < 0) + { + munmap (ei->image, ei->size); + maps_close (&mi); + goto err_exit; + } + } + + if (*segbase == *mapoff + && (*path == 0 || strcmp (path, "[vdso]") == 0)) + *mapoff = 0; + +err_exit: + if (!path) free (full_path); diff --git a/src/os-qnx.c b/src/os-qnx.c index f306929e6..c2dd8186f 100644 --- a/src/os-qnx.c +++ b/src/os-qnx.c @@ -291,9 +291,9 @@ _get_remote_elf_image(struct elf_image *ei, int -tdep_get_elf_image(struct elf_image *ei, pid_t pid, unw_word_t ip, +tdep_get_elf_image(unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen) + char *path, size_t pathlen, void *arg) { int ret = -UNW_ENOINFO; if (pid != getpid()) diff --git a/src/os-solaris.c b/src/os-solaris.c index 032bacf67..ee52045d1 100644 --- a/src/os-solaris.c +++ b/src/os-solaris.c @@ -30,9 +30,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "os-linux.h" // using linux header for map_iterator implementation int -tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, +tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen) + char *path, size_t pathlen, void *arg) { struct map_iterator mi; int found = 0, rc = UNW_ESUCCESS; diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c index 9444cbb86..c00cf7006 100644 --- a/src/ppc32/Ginit.c +++ b/src/ppc32/Ginit.c @@ -215,7 +215,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c index 8c54bab8a..04f8214c4 100644 --- a/src/ppc64/Ginit.c +++ b/src/ppc64/Ginit.c @@ -226,7 +226,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int diff --git a/src/ptrace/_UPT_find_proc_info.c b/src/ptrace/_UPT_find_proc_info.c index 0450b0847..a9bbac02c 100644 --- a/src/ptrace/_UPT_find_proc_info.c +++ b/src/ptrace/_UPT_find_proc_info.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "_UPT_internal.h" static int -get_unwind_info (struct elf_dyn_info *edi, pid_t pid, unw_addr_space_t as, unw_word_t ip) +get_unwind_info ( struct elf_dyn_info *edi, pid_t pid, unw_addr_space_t as, unw_word_t ip, void *arg) { unsigned long segbase, mapoff; char path[PATH_MAX]; @@ -58,8 +58,8 @@ get_unwind_info (struct elf_dyn_info *edi, pid_t pid, unw_addr_space_t as, unw_w invalidate_edi(edi); - if (tdep_get_elf_image (&edi->ei, pid, ip, &segbase, &mapoff, path, - sizeof(path)) < 0) + if (tdep_get_elf_image (as, &edi->ei, pid, ip, &segbase, &mapoff, path, + sizeof(path), arg) < 0) return -UNW_ENOINFO; /* Here, SEGBASE is the starting-address of the (mmap'ped) segment @@ -96,7 +96,7 @@ _UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, struct UPT_info *ui = arg; int ret = -UNW_ENOINFO; - if (get_unwind_info (&ui->edi, ui->pid, as, ip) < 0) + if (get_unwind_info (&ui->edi, ui->pid, as, ip,arg) < 0) return -UNW_ENOINFO; #if UNW_TARGET_IA64 diff --git a/src/ptrace/_UPT_get_elf_filename.c b/src/ptrace/_UPT_get_elf_filename.c index 401de3d18..0abd390da 100644 --- a/src/ptrace/_UPT_get_elf_filename.c +++ b/src/ptrace/_UPT_get_elf_filename.c @@ -29,9 +29,9 @@ _UPT_get_elf_filename (unw_addr_space_t as, unw_word_t ip, struct UPT_info *ui = arg; #if UNW_ELF_CLASS == UNW_ELFCLASS64 - return _Uelf64_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp); + return _Uelf64_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp,arg); #elif UNW_ELF_CLASS == UNW_ELFCLASS32 - return _Uelf32_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp); + return _Uelf32_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp,arg); #else return -UNW_ENOINFO; #endif diff --git a/src/ptrace/_UPT_get_proc_name.c b/src/ptrace/_UPT_get_proc_name.c index 4fc93e747..51a3b2507 100644 --- a/src/ptrace/_UPT_get_proc_name.c +++ b/src/ptrace/_UPT_get_proc_name.c @@ -33,9 +33,9 @@ _UPT_get_proc_name (unw_addr_space_t as, unw_word_t ip, struct UPT_info *ui = arg; #if UNW_ELF_CLASS == UNW_ELFCLASS64 - return _Uelf64_get_proc_name (as, ui->pid, ip, buf, buf_len, offp); + return _Uelf64_get_proc_name (as, ui->pid, ip, buf, buf_len, offp,arg); #elif UNW_ELF_CLASS == UNW_ELFCLASS32 - return _Uelf32_get_proc_name (as, ui->pid, ip, buf, buf_len, offp); + return _Uelf32_get_proc_name (as, ui->pid, ip, buf, buf_len, offp,arg); #else return -UNW_ENOINFO; #endif diff --git a/src/s390x/Ginit.c b/src/s390x/Ginit.c index 3cf07a5d7..59b0bb2f0 100644 --- a/src/s390x/Ginit.c +++ b/src/s390x/Ginit.c @@ -186,7 +186,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); } static int diff --git a/src/sh/Ginit.c b/src/sh/Ginit.c index ba62484c5..cae1d1a0b 100644 --- a/src/sh/Ginit.c +++ b/src/sh/Ginit.c @@ -163,7 +163,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); } static int diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c index 956d8088b..144d9f9f1 100644 --- a/src/x86/Ginit.c +++ b/src/x86/Ginit.c @@ -167,7 +167,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int @@ -175,7 +175,7 @@ get_static_elf_filename (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_elf_filename (as, getpid (), ip, buf, buf_len, offp); + return _Uelf32_get_elf_filename (as, getpid (), ip, buf, buf_len, offp, arg); } HIDDEN void diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c index ca3c02280..d82fd3ceb 100644 --- a/src/x86_64/Ginit.c +++ b/src/x86_64/Ginit.c @@ -165,7 +165,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg UNUSED) { - return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int @@ -173,7 +173,7 @@ get_static_elf_filename (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg UNUSED) { - return _Uelf64_get_elf_filename (as, getpid (), ip, buf, buf_len, offp); + return _Uelf64_get_elf_filename (as, getpid (), ip, buf, buf_len, offp, arg); } HIDDEN void From ac9e5bff5a15c8bf62ab7f29fdaf65ee7f86ce66 Mon Sep 17 00:00:00 2001 From: Abhijit Ray Chaudhury Date: Thu, 29 Feb 2024 15:19:37 +0530 Subject: [PATCH 2/2] fix the coding guidelines --- include/tdep-aarch64/libunwind_i.h | 2 +- include/tdep-arm/libunwind_i.h | 2 +- include/tdep-hppa/libunwind_i.h | 2 +- include/tdep-ia64/libunwind_i.h | 2 +- include/tdep-loongarch64/libunwind_i.h | 2 +- include/tdep-mips/libunwind_i.h | 2 +- include/tdep-ppc32/libunwind_i.h | 2 +- include/tdep-ppc64/libunwind_i.h | 2 +- include/tdep-s390x/libunwind_i.h | 2 +- include/tdep-sh/libunwind_i.h | 2 +- include/tdep-x86/libunwind_i.h | 2 +- include/tdep-x86_64/libunwind_i.h | 2 +- src/aarch64/Ginit.c | 4 ++-- src/arm/Ginit.c | 2 +- src/elfxx.c | 2 +- src/nto/unw_nto_find_proc_info.c | 2 +- src/ptrace/_UPT_find_proc_info.c | 2 +- src/ptrace/_UPT_get_elf_filename.c | 4 ++-- src/ptrace/_UPT_get_proc_name.c | 4 ++-- src/s390x/Ginit.c | 2 +- src/sh/Ginit.c | 2 +- 21 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/tdep-aarch64/libunwind_i.h b/include/tdep-aarch64/libunwind_i.h index ef54c42eb..2f422ac4a 100644 --- a/include/tdep-aarch64/libunwind_i.h +++ b/include/tdep-aarch64/libunwind_i.h @@ -323,7 +323,7 @@ extern void *tdep_uc_addr (unw_context_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, -- void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-arm/libunwind_i.h b/include/tdep-arm/libunwind_i.h index 18ac526b2..9132d0930 100644 --- a/include/tdep-arm/libunwind_i.h +++ b/include/tdep-arm/libunwind_i.h @@ -313,7 +313,7 @@ extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-hppa/libunwind_i.h b/include/tdep-hppa/libunwind_i.h index 84ab6d193..8e2bb2ea4 100644 --- a/include/tdep-hppa/libunwind_i.h +++ b/include/tdep-hppa/libunwind_i.h @@ -270,7 +270,7 @@ extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-ia64/libunwind_i.h b/include/tdep-ia64/libunwind_i.h index be031ef1d..c9ebb7fd1 100644 --- a/include/tdep-ia64/libunwind_i.h +++ b/include/tdep-ia64/libunwind_i.h @@ -264,7 +264,7 @@ extern void *tdep_uc_addr (ucontext_t *uc, unw_regnum_t regnum, extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-loongarch64/libunwind_i.h b/include/tdep-loongarch64/libunwind_i.h index 0f64cdaba..fb4f45d6f 100644 --- a/include/tdep-loongarch64/libunwind_i.h +++ b/include/tdep-loongarch64/libunwind_i.h @@ -242,7 +242,7 @@ extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-mips/libunwind_i.h b/include/tdep-mips/libunwind_i.h index 8fe6a4e41..b13a5a3a1 100644 --- a/include/tdep-mips/libunwind_i.h +++ b/include/tdep-mips/libunwind_i.h @@ -330,7 +330,7 @@ extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-ppc32/libunwind_i.h b/include/tdep-ppc32/libunwind_i.h index 3eda2a392..a115dddd8 100644 --- a/include/tdep-ppc32/libunwind_i.h +++ b/include/tdep-ppc32/libunwind_i.h @@ -303,7 +303,7 @@ extern void *tdep_uc_addr (ucontext_t * uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t * valp, int write); diff --git a/include/tdep-ppc64/libunwind_i.h b/include/tdep-ppc64/libunwind_i.h index aad954337..71b432fdb 100644 --- a/include/tdep-ppc64/libunwind_i.h +++ b/include/tdep-ppc64/libunwind_i.h @@ -358,7 +358,7 @@ extern void *tdep_uc_addr (ucontext_t * uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t * valp, int write); diff --git a/include/tdep-s390x/libunwind_i.h b/include/tdep-s390x/libunwind_i.h index d279022e5..b73fd3719 100644 --- a/include/tdep-s390x/libunwind_i.h +++ b/include/tdep-s390x/libunwind_i.h @@ -251,7 +251,7 @@ extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen), - void *arg; + void *arg; extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-sh/libunwind_i.h b/include/tdep-sh/libunwind_i.h index 52ac3c309..aecc12141 100644 --- a/include/tdep-sh/libunwind_i.h +++ b/include/tdep-sh/libunwind_i.h @@ -271,7 +271,7 @@ extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-x86/libunwind_i.h b/include/tdep-x86/libunwind_i.h index dcbae69c8..1b137227d 100644 --- a/include/tdep-x86/libunwind_i.h +++ b/include/tdep-x86/libunwind_i.h @@ -265,7 +265,7 @@ extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/include/tdep-x86_64/libunwind_i.h b/include/tdep-x86_64/libunwind_i.h index 72514be19..0b42627f3 100644 --- a/include/tdep-x86_64/libunwind_i.h +++ b/include/tdep-x86_64/libunwind_i.h @@ -278,7 +278,7 @@ extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (unw_addr_space_t as, struct elf_image *ei, pid_t pid, unw_word_t ip, unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen, - void *arg); + void *arg); extern void tdep_get_exe_image_path (char *path); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, int write); diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c index 7ab4c824b..77d817bcc 100644 --- a/src/aarch64/Ginit.c +++ b/src/aarch64/Ginit.c @@ -217,7 +217,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static unw_word_t empty_ptrauth_mask(unw_addr_space_t addr_space_unused, void *as_arg_unused) @@ -228,7 +228,7 @@ static unw_word_t empty_ptrauth_mask(unw_addr_space_t addr_space_unused, void *a static int get_static_elf_filename (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_elf_filename(as, getpid(), ip, buf, buf_len, offp,arg); + return _Uelf64_get_elf_filename(as, getpid(), ip, buf, buf_len, offp, arg); } HIDDEN void diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c index cfd440725..a74cd8fdb 100644 --- a/src/arm/Ginit.c +++ b/src/arm/Ginit.c @@ -167,7 +167,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int diff --git a/src/elfxx.c b/src/elfxx.c index dae3a2611..24f899645 100644 --- a/src/elfxx.c +++ b/src/elfxx.c @@ -634,7 +634,7 @@ elf_w (get_proc_name) (unw_addr_space_t as, pid_t pid, unw_word_t ip, int ret; char file[PATH_MAX]; - ret = tdep_get_elf_image (as, &ei, pid, ip, &segbase, &mapoff, file, PATH_MAX,arg); + ret = tdep_get_elf_image (as, &ei, pid, ip, &segbase, &mapoff, file, PATH_MAX, arg); if (ret < 0) return ret; diff --git a/src/nto/unw_nto_find_proc_info.c b/src/nto/unw_nto_find_proc_info.c index 870c08cdd..870ba646a 100644 --- a/src/nto/unw_nto_find_proc_info.c +++ b/src/nto/unw_nto_find_proc_info.c @@ -75,7 +75,7 @@ int unw_nto_find_proc_info (unw_addr_space_t as, &segbase, &mapoff, path, - sizeof (path),arg); + sizeof (path), arg); if (ret >= 0) { diff --git a/src/ptrace/_UPT_find_proc_info.c b/src/ptrace/_UPT_find_proc_info.c index a9bbac02c..180b62bc4 100644 --- a/src/ptrace/_UPT_find_proc_info.c +++ b/src/ptrace/_UPT_find_proc_info.c @@ -96,7 +96,7 @@ _UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, struct UPT_info *ui = arg; int ret = -UNW_ENOINFO; - if (get_unwind_info (&ui->edi, ui->pid, as, ip,arg) < 0) + if (get_unwind_info (&ui->edi, ui->pid, as, ip, arg) < 0) return -UNW_ENOINFO; #if UNW_TARGET_IA64 diff --git a/src/ptrace/_UPT_get_elf_filename.c b/src/ptrace/_UPT_get_elf_filename.c index 0abd390da..4efa77f10 100644 --- a/src/ptrace/_UPT_get_elf_filename.c +++ b/src/ptrace/_UPT_get_elf_filename.c @@ -29,9 +29,9 @@ _UPT_get_elf_filename (unw_addr_space_t as, unw_word_t ip, struct UPT_info *ui = arg; #if UNW_ELF_CLASS == UNW_ELFCLASS64 - return _Uelf64_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp,arg); + return _Uelf64_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp, arg); #elif UNW_ELF_CLASS == UNW_ELFCLASS32 - return _Uelf32_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp,arg); + return _Uelf32_get_elf_filename (as, ui->pid, ip, buf, buf_len, offp, arg); #else return -UNW_ENOINFO; #endif diff --git a/src/ptrace/_UPT_get_proc_name.c b/src/ptrace/_UPT_get_proc_name.c index 51a3b2507..a42cbcefe 100644 --- a/src/ptrace/_UPT_get_proc_name.c +++ b/src/ptrace/_UPT_get_proc_name.c @@ -33,9 +33,9 @@ _UPT_get_proc_name (unw_addr_space_t as, unw_word_t ip, struct UPT_info *ui = arg; #if UNW_ELF_CLASS == UNW_ELFCLASS64 - return _Uelf64_get_proc_name (as, ui->pid, ip, buf, buf_len, offp,arg); + return _Uelf64_get_proc_name (as, ui->pid, ip, buf, buf_len, offp, arg); #elif UNW_ELF_CLASS == UNW_ELFCLASS32 - return _Uelf32_get_proc_name (as, ui->pid, ip, buf, buf_len, offp,arg); + return _Uelf32_get_proc_name (as, ui->pid, ip, buf, buf_len, offp, arg); #else return -UNW_ENOINFO; #endif diff --git a/src/s390x/Ginit.c b/src/s390x/Ginit.c index 59b0bb2f0..d37087519 100644 --- a/src/s390x/Ginit.c +++ b/src/s390x/Ginit.c @@ -186,7 +186,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int diff --git a/src/sh/Ginit.c b/src/sh/Ginit.c index cae1d1a0b..6e96006fb 100644 --- a/src/sh/Ginit.c +++ b/src/sh/Ginit.c @@ -163,7 +163,7 @@ get_static_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { - return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp,arg); + return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp, arg); } static int