diff options
author | Juan Cespedes <cespedes@debian.org> | 2008-12-16 18:19:58 +0100 |
---|---|---|
committer | Juan Cespedes <cespedes@debian.org> | 2008-12-16 18:19:58 +0100 |
commit | f13505251e6402460f6cc7ec84e0d8ca91607b4f (patch) | |
tree | 883ded52fe552220b5500f761f8e3031de22c043 /sysdeps | |
parent | 7dd291227d81d3bc32c67e90fb7f7c51c76f39dd (diff) | |
download | ltrace-f13505251e6402460f6cc7ec84e0d8ca91607b4f.tar.gz |
Re-indent entry points to functions
Diffstat (limited to 'sysdeps')
35 files changed, 264 insertions, 268 deletions
diff --git a/sysdeps/linux-gnu/alpha/plt.c b/sysdeps/linux-gnu/alpha/plt.c index 86511a9..e5035db 100644 --- a/sysdeps/linux-gnu/alpha/plt.c +++ b/sysdeps/linux-gnu/alpha/plt.c @@ -2,12 +2,12 @@ #include "ltrace.h" #include "elf.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return lte->plt_addr + ndx * 12 + 32; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/alpha/regs.c b/sysdeps/linux-gnu/alpha/regs.c index fcba535..8bb98e0 100644 --- a/sysdeps/linux-gnu/alpha/regs.c +++ b/sysdeps/linux-gnu/alpha/regs.c @@ -16,22 +16,22 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 64 /* REG_PC */ , 0); } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { ptrace(PTRACE_POKEUSER, proc->pid, 64 /* REG_PC */ , addr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 30 /* REG_FP */ , 0); } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 26 /* RA */ , 0); } diff --git a/sysdeps/linux-gnu/alpha/trace.c b/sysdeps/linux-gnu/alpha/trace.c index 3099500..c31f7d0 100644 --- a/sysdeps/linux-gnu/alpha/trace.c +++ b/sysdeps/linux-gnu/alpha/trace.c @@ -19,14 +19,14 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { } /* Returns 1 if syscall, 2 if sysret, 0 otherwise. */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { char *ip = get_instruction_pointer(proc) - 4; @@ -47,8 +47,8 @@ int syscall_p(struct process *proc, int status, int *sysnum) return 0; } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { if (arg_num == -1) { /* return value */ return ptrace(PTRACE_PEEKUSER, proc->pid, 0 /* REG_R0 */ , 0); } @@ -71,6 +71,6 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return 0; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } diff --git a/sysdeps/linux-gnu/arm/breakpoint.c b/sysdeps/linux-gnu/arm/breakpoint.c index 2130dcb..d60e325 100644 --- a/sysdeps/linux-gnu/arm/breakpoint.c +++ b/sysdeps/linux-gnu/arm/breakpoint.c @@ -29,8 +29,8 @@ #include "output.h" #include "debug.h" -void arch_enable_breakpoint(pid_t pid, struct breakpoint *sbp) -{ +void +arch_enable_breakpoint(pid_t pid, struct breakpoint *sbp) { unsigned int i, j; const unsigned char break_insn[] = BREAKPOINT_VALUE; const unsigned char thumb_break_insn[] = THUMB_BREAKPOINT_VALUE; @@ -56,8 +56,8 @@ void arch_enable_breakpoint(pid_t pid, struct breakpoint *sbp) } } -void arch_disable_breakpoint(pid_t pid, const struct breakpoint *sbp) -{ +void +arch_disable_breakpoint(pid_t pid, const struct breakpoint *sbp) { unsigned int i, j; const unsigned char break_insn[] = BREAKPOINT_VALUE; const unsigned char thumb_break_insn[] = THUMB_BREAKPOINT_VALUE; diff --git a/sysdeps/linux-gnu/arm/plt.c b/sysdeps/linux-gnu/arm/plt.c index cc6005e..e5eb766 100644 --- a/sysdeps/linux-gnu/arm/plt.c +++ b/sysdeps/linux-gnu/arm/plt.c @@ -2,12 +2,12 @@ #include "ltrace.h" #include "elf.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return lte->plt_addr + 20 + ndx * 12; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/arm/regs.c b/sysdeps/linux-gnu/arm/regs.c index b1c4ae6..6a3e37a 100644 --- a/sysdeps/linux-gnu/arm/regs.c +++ b/sysdeps/linux-gnu/arm/regs.c @@ -20,25 +20,25 @@ #define off_lr 56 #define off_sp 52 -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, off_pc, 0); } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { ptrace(PTRACE_POKEUSER, proc->pid, off_pc, addr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, off_sp, 0); } /* really, this is given the *stack_pointer expecting * a CISC architecture; in our case, we don't need that */ -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { long addr = ptrace(PTRACE_PEEKUSER, proc->pid, off_lr, 0); proc->thumb_mode = addr & 1; diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c index b9be605..461ddaf 100644 --- a/sysdeps/linux-gnu/arm/trace.c +++ b/sysdeps/linux-gnu/arm/trace.c @@ -26,8 +26,8 @@ #define off_ip 48 #define off_pc 60 -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { proc_archdep *a; if (!proc->arch_ptr) @@ -41,8 +41,8 @@ void get_arch_dep(struct process *proc) * 3 if arch-specific syscall entry, 4 if arch-specific syscall exit, * -1 on error. */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { /* get the user's pc (plus 8) */ @@ -78,8 +78,8 @@ int syscall_p(struct process *proc, int status, int *sysnum) return 0; } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { proc_archdep *a = (proc_archdep *) proc->arch_ptr; if (arg_num == -1) { /* return value */ @@ -121,8 +121,8 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return 0; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { proc_archdep *a = (proc_archdep *) proc->arch_ptr; if (a->valid) { if (type == LT_TOF_FUNCTION) diff --git a/sysdeps/linux-gnu/breakpoint.c b/sysdeps/linux-gnu/breakpoint.c index 3e11b24..aa2b0f4 100644 --- a/sysdeps/linux-gnu/breakpoint.c +++ b/sysdeps/linux-gnu/breakpoint.c @@ -13,13 +13,13 @@ static unsigned char break_insn[] = BREAKPOINT_VALUE; #ifdef ARCH_HAVE_ENABLE_BREAKPOINT extern void arch_enable_breakpoint(pid_t, struct breakpoint *); -void enable_breakpoint(pid_t pid, struct breakpoint *sbp) -{ +void +enable_breakpoint(pid_t pid, struct breakpoint *sbp) { arch_enable_breakpoint(pid, sbp); } #else -void enable_breakpoint(pid_t pid, struct breakpoint *sbp) -{ +void +enable_breakpoint(pid_t pid, struct breakpoint *sbp) { unsigned int i, j; debug(1, "enable_breakpoint(%d,%p)", pid, sbp->addr); @@ -43,13 +43,13 @@ void enable_breakpoint(pid_t pid, struct breakpoint *sbp) #ifdef ARCH_HAVE_DISABLE_BREAKPOINT extern void arch_disable_breakpoint(pid_t, const struct breakpoint *sbp); -void disable_breakpoint(pid_t pid, const struct breakpoint *sbp) -{ +void +disable_breakpoint(pid_t pid, const struct breakpoint *sbp) { arch_disable_breakpoint(pid, sbp); } #else -void disable_breakpoint(pid_t pid, const struct breakpoint *sbp) -{ +void +disable_breakpoint(pid_t pid, const struct breakpoint *sbp) { unsigned int i, j; debug(2, "disable_breakpoint(%d,%p)", pid, sbp->addr); diff --git a/sysdeps/linux-gnu/i386/plt.c b/sysdeps/linux-gnu/i386/plt.c index e8a2349..2308ec2 100644 --- a/sysdeps/linux-gnu/i386/plt.c +++ b/sysdeps/linux-gnu/i386/plt.c @@ -2,12 +2,12 @@ #include "ltrace.h" #include "elf.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return lte->plt_addr + (ndx + 1) * 16; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/i386/regs.c b/sysdeps/linux-gnu/i386/regs.c index 158fa24..19d9572 100644 --- a/sysdeps/linux-gnu/i386/regs.c +++ b/sysdeps/linux-gnu/i386/regs.c @@ -16,22 +16,22 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 4 * EIP, 0); } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { ptrace(PTRACE_POKEUSER, proc->pid, 4 * EIP, (long)addr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 4 * UESP, 0); } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { return (void *)ptrace(PTRACE_PEEKTEXT, proc->pid, stack_pointer, 0); } diff --git a/sysdeps/linux-gnu/i386/trace.c b/sysdeps/linux-gnu/i386/trace.c index 6e64c46..d27b238 100644 --- a/sysdeps/linux-gnu/i386/trace.c +++ b/sysdeps/linux-gnu/i386/trace.c @@ -19,14 +19,14 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { } /* Returns 1 if syscall, 2 if sysret, 0 otherwise. */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { *sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4 * ORIG_EAX, 0); @@ -43,8 +43,8 @@ int syscall_p(struct process *proc, int status, int *sysnum) return 0; } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { if (arg_num == -1) { /* return value */ return ptrace(PTRACE_PEEKUSER, proc->pid, 4 * EAX, 0); } @@ -81,6 +81,6 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return 0; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } diff --git a/sysdeps/linux-gnu/ia64/breakpoint.c b/sysdeps/linux-gnu/ia64/breakpoint.c index 6d20d18..2d741bb 100644 --- a/sysdeps/linux-gnu/ia64/breakpoint.c +++ b/sysdeps/linux-gnu/ia64/breakpoint.c @@ -11,8 +11,8 @@ #include "output.h" #include "debug.h" -static long long extract_bit_field(char *bundle, int from, int len) -{ +static long long +extract_bit_field(char *bundle, int from, int len) { long long result = 0LL; int to = from + len; int from_byte = from / 8; @@ -43,8 +43,8 @@ static long long extract_bit_field(char *bundle, int from, int len) } /* Replace the specified bits in an instruction bundle */ -static void replace_bit_field(char *bundle, long long val, int from, int len) -{ +static void +replace_bit_field(char *bundle, long long val, int from, int len) { int to = from + len; int from_byte = from / 8; int to_byte = to / 8; @@ -89,15 +89,15 @@ static void replace_bit_field(char *bundle, long long val, int from, int len) /* Return the contents of slot N (for N = 0, 1, or 2) in and instruction bundle */ -static long long slotN_contents(char *bundle, int slotnum) -{ +static long long +slotN_contents(char *bundle, int slotnum) { return extract_bit_field(bundle, 5 + 41 * slotnum, 41); } /* Store an instruction in an instruction bundle */ -static void replace_slotN_contents(char *bundle, long long instr, int slotnum) -{ +static void +replace_slotN_contents(char *bundle, long long instr, int slotnum) { replace_bit_field(bundle, instr, 5 + 41 * slotnum, 41); } @@ -152,8 +152,8 @@ union bundle_t { unsigned long ubundle[2]; }; -void arch_enable_breakpoint(pid_t pid, struct breakpoint *sbp) -{ +void +arch_enable_breakpoint(pid_t pid, struct breakpoint *sbp) { unsigned long addr = (unsigned long)sbp->addr; union bundle_t bundle; @@ -189,8 +189,8 @@ void arch_enable_breakpoint(pid_t pid, struct breakpoint *sbp) } -void arch_disable_breakpoint(pid_t pid, const struct breakpoint *sbp) -{ +void +arch_disable_breakpoint(pid_t pid, const struct breakpoint *sbp) { unsigned long addr = (unsigned long)sbp->addr; int slotnum = (int)(addr & 0x0f) & 0x3; diff --git a/sysdeps/linux-gnu/ia64/plt.c b/sysdeps/linux-gnu/ia64/plt.c index b1d1af4..c3b73bf 100644 --- a/sysdeps/linux-gnu/ia64/plt.c +++ b/sysdeps/linux-gnu/ia64/plt.c @@ -24,8 +24,8 @@ */ -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { /* Find number of entires by removing header and special * entry, dividing total size by three, since each PLT entry * will have 3 bundles (1 for inital entry and two for the PLT @@ -42,7 +42,7 @@ GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) return addr; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/ia64/regs.c b/sysdeps/linux-gnu/ia64/regs.c index b864031..e694a3a 100644 --- a/sysdeps/linux-gnu/ia64/regs.c +++ b/sysdeps/linux-gnu/ia64/regs.c @@ -12,8 +12,8 @@ #include "debug.h" #include "ltrace.h" -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { unsigned long ip = ptrace(PTRACE_PEEKUSER, proc->pid, PT_CR_IIP, 0); unsigned long slot = (ptrace(PTRACE_PEEKUSER, proc->pid, PT_CR_IPSR, 0) >> 41) & 3; @@ -21,8 +21,8 @@ void *get_instruction_pointer(struct process *proc) return (void *)(ip | slot); } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { unsigned long newip = (unsigned long)addr; unsigned long slot = (unsigned long)addr & 0xf; @@ -37,12 +37,12 @@ void set_instruction_pointer(struct process *proc, void *addr) ptrace(PTRACE_POKEUSER, proc->pid, PT_CR_IPSR, psr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, PT_R12, 0); } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, PT_B0, 0); } diff --git a/sysdeps/linux-gnu/ia64/trace.c b/sysdeps/linux-gnu/ia64/trace.c index 565cd6f..9d2aa5e 100644 --- a/sysdeps/linux-gnu/ia64/trace.c +++ b/sysdeps/linux-gnu/ia64/trace.c @@ -46,9 +46,8 @@ union cfm_t { unsigned long value; }; -int syscall_p(struct process *proc, int status, int *sysnum) -{ - +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { unsigned long slot = @@ -121,16 +120,15 @@ int syscall_p(struct process *proc, int status, int *sysnum) the GPL (http://www.gelato.unsw.edu.au/archives/linux-ia64/0104/1405.html) */ static inline double -fpreg_to_double (struct ia64_fpreg *fp) -{ +fpreg_to_double (struct ia64_fpreg *fp) { double result; asm ("ldf.fill %0=%1" : "=f"(result) : "m"(*fp)); return result; } -static long gimme_long_arg(enum tof type, struct process *proc, int arg_num) -{ +static long +gimme_long_arg(enum tof type, struct process *proc, int arg_num) { union cfm_t cfm; unsigned long bsp; @@ -181,8 +179,8 @@ static long gimme_long_arg(enum tof type, struct process *proc, int arg_num) static long float_regs[8] = { PT_F8, PT_F9, PT_F10, PT_F11, PT_F12, PT_F13, PT_F14, PT_F15 }; -static double gimme_float_arg(enum tof type, struct process *proc, int arg_num) -{ +static double +gimme_float_arg(enum tof type, struct process *proc, int arg_num) { union cfm_t cfm; unsigned long bsp; struct ia64_fpreg reg; @@ -245,8 +243,8 @@ static double gimme_float_arg(enum tof type, struct process *proc, int arg_num) exit(1); } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { union { long l; float f; @@ -263,10 +261,10 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return cvt.l; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { } diff --git a/sysdeps/linux-gnu/m68k/plt.c b/sysdeps/linux-gnu/m68k/plt.c index 8ee29e0..00cac8c 100644 --- a/sysdeps/linux-gnu/m68k/plt.c +++ b/sysdeps/linux-gnu/m68k/plt.c @@ -2,13 +2,13 @@ #include "ltrace.h" #include "elf.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return lte->plt_addr + (ndx + 1) * ((lte->ehdr.e_flags & EF_CPU32) ? 24 : 12); } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/m68k/regs.c b/sysdeps/linux-gnu/m68k/regs.c index d953d28..e88f39f 100644 --- a/sysdeps/linux-gnu/m68k/regs.c +++ b/sysdeps/linux-gnu/m68k/regs.c @@ -16,22 +16,22 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 4 * PT_PC, 0); } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { ptrace(PTRACE_POKEUSER, proc->pid, 4 * PT_PC, addr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 4 * PT_USP, 0); } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { return (void *)ptrace(PTRACE_PEEKTEXT, proc->pid, stack_pointer, 0); } diff --git a/sysdeps/linux-gnu/m68k/trace.c b/sysdeps/linux-gnu/m68k/trace.c index 14053db..2d63820 100644 --- a/sysdeps/linux-gnu/m68k/trace.c +++ b/sysdeps/linux-gnu/m68k/trace.c @@ -18,14 +18,14 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { } /* Returns 1 if syscall, 2 if sysret, 0 otherwise. */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { int depth; if (WIFSTOPPED(status) @@ -48,8 +48,8 @@ int syscall_p(struct process *proc, int status, int *sysnum) return 0; } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { if (arg_num == -1) { /* return value */ return ptrace(PTRACE_PEEKUSER, proc->pid, 4 * PT_D0, 0); } @@ -87,6 +87,6 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return 0; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } diff --git a/sysdeps/linux-gnu/mipsel/plt.c b/sysdeps/linux-gnu/mipsel/plt.c index 75bdbca..10b3897 100644 --- a/sysdeps/linux-gnu/mipsel/plt.c +++ b/sysdeps/linux-gnu/mipsel/plt.c @@ -32,8 +32,8 @@ Called by read_elf when building the symbol table. */ -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { debug(1,"plt_addr %x ndx %#x",lte->pltgot_addr, ndx); return lte->pltgot_addr + @@ -59,8 +59,8 @@ GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) breakpoint changes I just add a new breakpoint for the new address. */ -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { long ret; if(!proc->pid){ return 0; diff --git a/sysdeps/linux-gnu/mipsel/regs.c b/sysdeps/linux-gnu/mipsel/regs.c index 136bf06..23d681e 100644 --- a/sysdeps/linux-gnu/mipsel/regs.c +++ b/sysdeps/linux-gnu/mipsel/regs.c @@ -28,8 +28,8 @@ \param proc The process to work on. \return The current instruction pointer. */ -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, off_pc, 0); } @@ -42,8 +42,8 @@ void *get_instruction_pointer(struct process *proc) \todo Our mips kernel ptrace doesn't support PTRACE_SINGLESTEP, so we \c continue_process() after a breakpoint. Check if this is OK. */ -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { ptrace(PTRACE_POKEUSER, proc->pid, off_pc, addr); } @@ -51,8 +51,8 @@ void set_instruction_pointer(struct process *proc, void *addr) \param proc The process to work on. \return The current stack pointer. */ -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, off_sp, 0); } @@ -66,8 +66,8 @@ void *get_stack_pointer(struct process *proc) Mips uses r31 for the return address, so the stack_pointer is unused. */ -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, off_lr, 0); } /**@}*/ diff --git a/sysdeps/linux-gnu/mipsel/trace.c b/sysdeps/linux-gnu/mipsel/trace.c index fa513e3..c65f9ec 100644 --- a/sysdeps/linux-gnu/mipsel/trace.c +++ b/sysdeps/linux-gnu/mipsel/trace.c @@ -36,9 +36,8 @@ Most targets just return here. A couple use proc->arch_ptr for a private data area. */ -void get_arch_dep(struct process *proc) -{ - +void +get_arch_dep(struct process *proc) { } /** @@ -58,8 +57,8 @@ void get_arch_dep(struct process *proc) by a base from the others. On our system, it looks like the base for the system calls is 4000. */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { /* get the user's pc (plus 8) */ @@ -118,8 +117,8 @@ arguments somewhere on the call. I'm not doing any floating point support here. */ -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { long ret; debug(2,"type %d arg %d",type,arg_num); if (type == LT_TOF_FUNCTION || type == LT_TOF_SYSCALL){ @@ -162,8 +161,8 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * stash off the arguments on a call so we have them on the return. */ -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } /**@}*/ diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c index 6d3d371..d74caf5 100644 --- a/sysdeps/linux-gnu/ppc/plt.c +++ b/sysdeps/linux-gnu/ppc/plt.c @@ -5,13 +5,13 @@ #include "ptrace.h" #include "options.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return rela->r_offset; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { void *addr = sym->enter_addr; long pt_ret; diff --git a/sysdeps/linux-gnu/ppc/regs.c b/sysdeps/linux-gnu/ppc/regs.c index 5127181..61e7b62 100644 --- a/sysdeps/linux-gnu/ppc/regs.c +++ b/sysdeps/linux-gnu/ppc/regs.c @@ -16,32 +16,32 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_NIP, 0); } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { ptrace(PTRACE_POKEUSER, proc->pid, sizeof(long) * PT_NIP, addr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_R1, 0); } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_LNK, 0); } /* Grab the value of CTR registers. */ -void *get_count_register (struct process *proc) -{ +void * +get_count_register (struct process *proc) { return (void *) ptrace (PTRACE_PEEKUSER, proc->pid, sizeof (long) * PT_CTR, 0); } diff --git a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c index 056b95f..6dbad4e 100644 --- a/sysdeps/linux-gnu/ppc/trace.c +++ b/sysdeps/linux-gnu/ppc/trace.c @@ -20,8 +20,8 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { #ifdef __powerpc64__ if (proc->arch_ptr) return; @@ -37,8 +37,8 @@ unsigned int greg = 3; unsigned int freg = 1; unsigned int vreg = 2; -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { long pc = (long)get_instruction_pointer(proc); @@ -62,8 +62,8 @@ int syscall_p(struct process *proc, int status, int *sysnum) } /* Grab functions arguments based on the PPC64 ABI. */ -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { long data; if (type == LT_TOF_FUNCTIONR) { @@ -121,13 +121,13 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return 0; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } /* Read a single long from the process's memory address 'addr'. */ -int arch_umovelong (struct process *proc, void *addr, long *result, arg_type_info *info) -{ +int +arch_umovelong (struct process *proc, void *addr, long *result, arg_type_info *info) { long pointed_to; errno = 0; diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c index 201fb6d..61e202e 100644 --- a/sysdeps/linux-gnu/proc.c +++ b/sysdeps/linux-gnu/proc.c @@ -18,8 +18,8 @@ /* * Returns a file name corresponding to a running pid */ -char *pid2name(pid_t pid) -{ +char * +pid2name(pid_t pid) { char proc_exe[1024]; if (!kill(pid, 0)) { diff --git a/sysdeps/linux-gnu/s390/plt.c b/sysdeps/linux-gnu/s390/plt.c index ffe7f11..0affab2 100644 --- a/sysdeps/linux-gnu/s390/plt.c +++ b/sysdeps/linux-gnu/s390/plt.c @@ -2,12 +2,12 @@ #include "ltrace.h" #include "elf.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return lte->plt_addr + (ndx + 1) * 32; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/s390/regs.c b/sysdeps/linux-gnu/s390/regs.c index 29f9514..b22ca84 100644 --- a/sysdeps/linux-gnu/s390/regs.c +++ b/sysdeps/linux-gnu/s390/regs.c @@ -28,8 +28,8 @@ #define PSW_MASK 0x7fffffff #endif -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { long ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_PSWADDR, 0) & PSW_MASK; #ifdef __s390x__ if (proc->mask_32bit) @@ -38,8 +38,8 @@ void *get_instruction_pointer(struct process *proc) return (void *)ret; } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { #ifdef __s390x__ if (proc->mask_32bit) addr = (void *)((long)addr & PSW_MASK31); @@ -47,8 +47,8 @@ void set_instruction_pointer(struct process *proc, void *addr) ptrace(PTRACE_POKEUSER, proc->pid, PT_PSWADDR, addr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { long ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR15, 0) & PSW_MASK; #ifdef __s390x__ if (proc->mask_32bit) @@ -57,8 +57,8 @@ void *get_stack_pointer(struct process *proc) return (void *)ret; } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { long ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR14, 0) & PSW_MASK; #ifdef __s390x__ if (proc->mask_32bit) diff --git a/sysdeps/linux-gnu/s390/trace.c b/sysdeps/linux-gnu/s390/trace.c index 51c55de..dbb409f 100644 --- a/sysdeps/linux-gnu/s390/trace.c +++ b/sysdeps/linux-gnu/s390/trace.c @@ -29,8 +29,8 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { #ifdef __s390x__ unsigned long psw; @@ -50,8 +50,8 @@ void get_arch_dep(struct process *proc) /* Returns 1 if syscall, 2 if sysret, 0 otherwise. */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { long pc, opcode, offset_reg, scno, tmp; void *svc_addr; int gpr_offset[16] = { PT_GPR0, PT_GPR1, PT_ORIGGPR2, PT_GPR3, @@ -161,8 +161,8 @@ int syscall_p(struct process *proc, int status, int *sysnum) return 0; } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { long ret; switch (arg_num) { @@ -195,6 +195,6 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return ret; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } diff --git a/sysdeps/linux-gnu/sparc/plt.c b/sysdeps/linux-gnu/sparc/plt.c index 87dad8c..3568ea9 100644 --- a/sysdeps/linux-gnu/sparc/plt.c +++ b/sysdeps/linux-gnu/sparc/plt.c @@ -2,12 +2,12 @@ #include "ltrace.h" #include "elf.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return rela->r_offset + 4; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/sparc/regs.c b/sysdeps/linux-gnu/sparc/regs.c index 1f2861a..0726eeb 100644 --- a/sysdeps/linux-gnu/sparc/regs.c +++ b/sysdeps/linux-gnu/sparc/regs.c @@ -6,31 +6,31 @@ #include "ptrace.h" #include "ltrace.h" -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { proc_archdep *a = (proc_archdep *) (proc->arch_ptr); if (a->valid) return (void *)a->regs.r_pc; return (void *)-1; } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { proc_archdep *a = (proc_archdep *) (proc->arch_ptr); if (a->valid) a->regs.r_pc = (long)addr; } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { proc_archdep *a = (proc_archdep *) (proc->arch_ptr); if (a->valid) return (void *)a->regs.r_o6; return (void *)-1; } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { proc_archdep *a = (proc_archdep *) (proc->arch_ptr); unsigned int t; if (!a->valid) diff --git a/sysdeps/linux-gnu/sparc/trace.c b/sysdeps/linux-gnu/sparc/trace.c index 354f7e7..3e9246c 100644 --- a/sysdeps/linux-gnu/sparc/trace.c +++ b/sysdeps/linux-gnu/sparc/trace.c @@ -13,8 +13,8 @@ extern FILE *output; extern int opt_d; -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { proc_archdep *a; if (!proc->arch_ptr) proc->arch_ptr = (void *)malloc(sizeof(proc_archdep)); @@ -25,8 +25,8 @@ void get_arch_dep(struct process *proc) /* Returns syscall number if `pid' stopped because of a syscall. * Returns -1 otherwise */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { void *ip = get_instruction_pointer(proc); @@ -48,8 +48,8 @@ int syscall_p(struct process *proc, int status, int *sysnum) return 0; } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { proc_archdep *a = (proc_archdep *) proc->arch_ptr; if (!a->valid) { fprintf(stderr, "Could not get child registers\n"); @@ -74,8 +74,8 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return 0; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { proc_archdep *a = (proc_archdep *) proc->arch_ptr; if (a->valid) { if (type == LT_TOF_FUNCTION) diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c index 66cd3d5..f348fc8 100644 --- a/sysdeps/linux-gnu/trace.c +++ b/sysdeps/linux-gnu/trace.c @@ -75,14 +75,14 @@ static int fork_exec_syscalls[][5] = { #ifdef ARCH_HAVE_UMOVELONG extern int arch_umovelong (struct process *, void *, long *, arg_type_info *); -int umovelong (struct process *proc, void *addr, long *result, arg_type_info *info) -{ +int +umovelong (struct process *proc, void *addr, long *result, arg_type_info *info) { return arch_umovelong (proc, addr, result, info); } #else /* Read a single long from the process's memory address 'addr' */ -int umovelong (struct process *proc, void *addr, long *result, arg_type_info *info) -{ +int +umovelong (struct process *proc, void *addr, long *result, arg_type_info *info) { long pointed_to; errno = 0; @@ -100,8 +100,8 @@ int umovelong (struct process *proc, void *addr, long *result, arg_type_info *in * (ie, with fork() or clone()) * Returns 0 otherwise. */ -int fork_p(struct process *proc, int sysnum) -{ +int +fork_p(struct process *proc, int sysnum) { unsigned int i; if (proc->personality >= sizeof fork_exec_syscalls / sizeof(fork_exec_syscalls[0])) @@ -114,8 +114,8 @@ int fork_p(struct process *proc, int sysnum) /* Returns 1 if the sysnum may make the process exec other program */ -int exec_p(struct process *proc, int sysnum) -{ +int +exec_p(struct process *proc, int sysnum) { int i; if (proc->personality >= sizeof fork_exec_syscalls / sizeof(fork_exec_syscalls[0])) @@ -128,8 +128,8 @@ int exec_p(struct process *proc, int sysnum) /* Check that we just hit an exec. */ -int was_exec(struct process *proc, int status) -{ +int +was_exec(struct process *proc, int status) { if (!WIFSTOPPED (status)) return 0; @@ -159,16 +159,16 @@ int was_exec(struct process *proc, int status) return 0; } -void trace_me(void) -{ +void +trace_me(void) { if (ptrace(PTRACE_TRACEME, 0, 1, 0) < 0) { perror("PTRACE_TRACEME"); exit(1); } } -int trace_pid(pid_t pid) -{ +int +trace_pid(pid_t pid) { if (ptrace(PTRACE_ATTACH, pid, 1, 0) < 0) { return -1; } @@ -176,8 +176,8 @@ int trace_pid(pid_t pid) return 0; } -void trace_set_options(struct process *proc, pid_t pid) -{ +void +trace_set_options(struct process *proc, pid_t pid) { if (proc->tracesysgood & 0x80) return; @@ -190,30 +190,30 @@ void trace_set_options(struct process *proc, pid_t pid) proc->tracesysgood |= 0x80; } -void untrace_pid(pid_t pid) -{ +void +untrace_pid(pid_t pid) { ptrace(PTRACE_DETACH, pid, 1, 0); } -void continue_after_signal(pid_t pid, int signum) -{ +void +continue_after_signal(pid_t pid, int signum) { /* We should always trace syscalls to be able to control fork(), clone(), execve()... */ ptrace(PTRACE_SYSCALL, pid, 0, signum); } -void continue_process(pid_t pid) -{ +void +continue_process(pid_t pid) { continue_after_signal(pid, 0); } -void continue_enabling_breakpoint(pid_t pid, struct breakpoint *sbp) -{ +void +continue_enabling_breakpoint(pid_t pid, struct breakpoint *sbp) { enable_breakpoint(pid, sbp); continue_process(pid); } -void continue_after_breakpoint(struct process *proc, struct breakpoint *sbp) -{ +void +continue_after_breakpoint(struct process *proc, struct breakpoint *sbp) { if (sbp->enabled) disable_breakpoint(proc->pid, sbp); set_instruction_pointer(proc, sbp->addr); @@ -234,8 +234,8 @@ void continue_after_breakpoint(struct process *proc, struct breakpoint *sbp) 'addr' and continuing until a NUL ('\0') is seen or 'len' bytes have been read. */ -int umovestr(struct process *proc, void *addr, int len, void *laddr) -{ +int +umovestr(struct process *proc, void *addr, int len, void *laddr) { union { long a; char c[sizeof(long)]; diff --git a/sysdeps/linux-gnu/x86_64/plt.c b/sysdeps/linux-gnu/x86_64/plt.c index e8a2349..2308ec2 100644 --- a/sysdeps/linux-gnu/x86_64/plt.c +++ b/sysdeps/linux-gnu/x86_64/plt.c @@ -2,12 +2,12 @@ #include "ltrace.h" #include "elf.h" -GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) -{ +GElf_Addr +arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) { return lte->plt_addr + (ndx + 1) * 16; } -void *sym2addr(struct process *proc, struct library_symbol *sym) -{ +void * +sym2addr(struct process *proc, struct library_symbol *sym) { return sym->enter_addr; } diff --git a/sysdeps/linux-gnu/x86_64/regs.c b/sysdeps/linux-gnu/x86_64/regs.c index 160f08f..f078aad 100644 --- a/sysdeps/linux-gnu/x86_64/regs.c +++ b/sysdeps/linux-gnu/x86_64/regs.c @@ -16,31 +16,31 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void *get_instruction_pointer(struct process *proc) -{ +void * +get_instruction_pointer(struct process *proc) { long int ret = ptrace(PTRACE_PEEKUSER, proc->pid, 8 * RIP, 0); if (proc->mask_32bit) ret &= 0xffffffff; return (void *)ret; } -void set_instruction_pointer(struct process *proc, void *addr) -{ +void +set_instruction_pointer(struct process *proc, void *addr) { if (proc->mask_32bit) addr = (void *)((long int)addr & 0xffffffff); ptrace(PTRACE_POKEUSER, proc->pid, 8 * RIP, addr); } -void *get_stack_pointer(struct process *proc) -{ +void * +get_stack_pointer(struct process *proc) { long int ret = ptrace(PTRACE_PEEKUSER, proc->pid, 8 * RSP, 0); if (proc->mask_32bit) ret &= 0xffffffff; return (void *)ret; } -void *get_return_addr(struct process *proc, void *stack_pointer) -{ +void * +get_return_addr(struct process *proc, void *stack_pointer) { unsigned long int ret; ret = ptrace(PTRACE_PEEKTEXT, proc->pid, stack_pointer, 0); if (proc->mask_32bit) diff --git a/sysdeps/linux-gnu/x86_64/trace.c b/sysdeps/linux-gnu/x86_64/trace.c index 57d0e1f..f37eb2e 100644 --- a/sysdeps/linux-gnu/x86_64/trace.c +++ b/sysdeps/linux-gnu/x86_64/trace.c @@ -19,8 +19,8 @@ # define PTRACE_POKEUSER PTRACE_POKEUSR #endif -void get_arch_dep(struct process *proc) -{ +void +get_arch_dep(struct process *proc) { unsigned long cs; if (proc->arch_ptr) return; @@ -34,8 +34,8 @@ void get_arch_dep(struct process *proc) /* Returns 1 if syscall, 2 if sysret, 0 otherwise. */ -int syscall_p(struct process *proc, int status, int *sysnum) -{ +int +syscall_p(struct process *proc, int status, int *sysnum) { if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) { *sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 8 * ORIG_RAX, 0); @@ -53,8 +53,7 @@ int syscall_p(struct process *proc, int status, int *sysnum) } static unsigned int -gimme_arg32(enum tof type, struct process *proc, int arg_num) -{ +gimme_arg32(enum tof type, struct process *proc, int arg_num) { if (arg_num == -1) { /* return value */ return ptrace(PTRACE_PEEKUSER, proc->pid, 8 * RAX, 0); } @@ -86,8 +85,8 @@ gimme_arg32(enum tof type, struct process *proc, int arg_num) exit(1); } -long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) -{ +long +gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info) { if (proc->mask_32bit) return (unsigned int)gimme_arg32(type, proc, arg_num); @@ -141,6 +140,6 @@ long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info * return 0; } -void save_register_args(enum tof type, struct process *proc) -{ +void +save_register_args(enum tof type, struct process *proc) { } |