diff options
48 files changed, 188 insertions, 131 deletions
@@ -5,6 +5,12 @@ * proc.c: Call it. * configure.ac: Add support for libselinux. +2012-02-09 Petr Machata <pmachata@redhat.com> + + * proc.h: New file. Move there struct Process and related types + and function declarations. Update includes across the code. + (struct Event_Handler): Rename to struct event_handler. + 2012-02-07 Petr Machata <pmachata@redhat.com> * breakpoint.h (typedef Breakpoint): Drop. diff --git a/breakpoints.c b/breakpoints.c index 5713fe4..5a473a9 100644 --- a/breakpoints.c +++ b/breakpoints.c @@ -10,6 +10,7 @@ #include "breakpoint.h" #include "common.h" +#include "proc.h" void breakpoint_on_hit(struct breakpoint *bp, struct Process *proc) @@ -2,9 +2,6 @@ #define COMMON_H #include <config.h> -#if defined(HAVE_LIBUNWIND) -#include <libunwind.h> -#endif /* defined(HAVE_LIBUNWIND) */ #include <sys/types.h> #include <sys/time.h> @@ -134,98 +131,6 @@ struct library_symbol { struct library_symbol * next; }; -struct callstack_element { - union { - int syscall; - struct library_symbol * libfunc; - } c_un; - int is_syscall; - void * return_addr; - struct timeval time_spent; - void * arch_ptr; -}; - -#define MAX_CALLDEPTH 64 - -typedef enum Process_State Process_State; -enum Process_State { - STATE_ATTACHED = 0, - STATE_BEING_CREATED, - STATE_IGNORED /* ignore this process (it's a fork and no -f was used) */ -}; - -typedef struct Event_Handler Event_Handler; -struct Event_Handler { - /* Event handler that overrides the default one. Should - * return NULL if the event was handled, otherwise the - * returned event is passed to the default handler. */ - Event * (* on_event)(Event_Handler * self, Event * event); - - /* Called when the event handler removal is requested. */ - void (* destroy)(Event_Handler * self); -}; - -/* XXX We would rather have this all organized a little differently, - * have Process for the whole group and Task for what's there for - * per-thread stuff. But for now this is the less invasive way of - * structuring it. */ -struct Process { - Process_State state; - Process * parent; /* needed by STATE_BEING_CREATED */ - char * filename; - pid_t pid; - - /* Dictionary of breakpoints (which is a mapping - * address->breakpoint). This is NULL for non-leader - * processes. */ - Dict * breakpoints; - - int mask_32bit; /* 1 if 64-bit ltrace is tracing 32-bit process */ - unsigned int personality; - int tracesysgood; /* signal indicating a PTRACE_SYSCALL trap */ - - int callstack_depth; - struct callstack_element callstack[MAX_CALLDEPTH]; - struct library_symbol * list_of_symbols; - - int libdl_hooked; - /* Arch-dependent: */ - void * debug; /* arch-dep process debug struct */ - long debug_state; /* arch-dep debug state */ - void * instruction_pointer; - void * stack_pointer; /* To get return addr, args... */ - void * return_addr; - void * arch_ptr; - short e_machine; - short need_to_reinitialize_breakpoints; -#ifdef __arm__ - int thumb_mode; /* ARM execution mode: 0: ARM, 1: Thumb */ -#endif - -#if defined(HAVE_LIBUNWIND) - /* libunwind address space */ - unw_addr_space_t unwind_as; - void *unwind_priv; -#endif /* defined(HAVE_LIBUNWIND) */ - - /* Set in leader. */ - Event_Handler * event_handler; - - - /** - * Process chaining. - **/ - Process * next; - - /* LEADER points to the leader thread of the POSIX.1 process. - If X->LEADER == X, then X is the leader thread and the - Process structures chained by NEXT represent other threads, - up until, but not including, the next leader thread. - LEADER may be NULL after the leader has already exited. In - that case this process is waiting to be collected. */ - Process * leader; -}; - struct opt_c_struct { int count; struct timeval tv; @@ -248,23 +153,6 @@ enum process_status { ps_other, /* Necessary other states can be added as needed. */ }; -enum pcb_status { - pcb_stop, /* The iteration should stop. */ - pcb_cont, /* The iteration should continue. */ -}; - -/* Process list */ -extern Process * pid2proc(pid_t pid); -extern void add_process(Process * proc); -extern void remove_process(Process * proc); -extern void change_process_leader(Process * proc, Process * leader); -extern Process *each_process(Process * start, - enum pcb_status (* cb)(Process * proc, void * data), - void * data); -extern Process *each_task(Process * start, - enum pcb_status (* cb)(Process * proc, void * data), - void * data); - /* Events */ enum ecb_status { ecb_cont, /* The iteration should continue. */ @@ -279,15 +167,10 @@ extern Event * each_qd_event(enum ecb_status (* cb)(Event * event, void * data), extern void enque_event(Event * event); extern void handle_event(Event * event); -extern void install_event_handler(Process * proc, Event_Handler * handler); -extern void destroy_event_handler(Process * proc); - extern pid_t execute_program(const char * command, char ** argv); extern int display_arg(enum tof type, Process * proc, int arg_num, arg_type_info * info); extern void disable_all_breakpoints(Process * proc); -extern Process * open_program(char * filename, pid_t pid, int init_breakpoints); -extern void open_pid(pid_t pid); extern void show_summary(void); extern arg_type_info * lookup_prototype(enum arg_type at); diff --git a/display_args.c b/display_args.c index c639c88..5df34ca 100644 --- a/display_args.c +++ b/display_args.c @@ -5,6 +5,7 @@ #include <limits.h> #include "common.h" +#include "proc.h" static int display_char(int what); static int display_string(enum tof type, Process *proc, diff --git a/handle_event.c b/handle_event.c index ec4c9f3..afabd96 100644 --- a/handle_event.c +++ b/handle_event.c @@ -15,6 +15,7 @@ #include "common.h" #include "breakpoint.h" +#include "proc.h" static void handle_signal(Event *event); static void handle_exit(Event *event); @@ -42,7 +43,7 @@ call_handler(Process * proc, Event * event) { assert(proc != NULL); - Event_Handler * handler = proc->event_handler; + struct event_handler *handler = proc->event_handler; if (handler == NULL) return event; diff --git a/libltrace.c b/libltrace.c index 777ad1b..dcd5537 100644 --- a/libltrace.c +++ b/libltrace.c @@ -10,6 +10,7 @@ #include <sys/wait.h> #include "common.h" +#include "proc.h" char *command = NULL; diff --git a/ltrace-elf.c b/ltrace-elf.c index f7fc239..d379178 100644 --- a/ltrace-elf.c +++ b/ltrace-elf.c @@ -13,6 +13,7 @@ #include <assert.h> #include "common.h" +#include "proc.h" void do_close_elf(struct ltelf *lte); void add_library_symbol(GElf_Addr addr, const char *name, @@ -1,3 +1,6 @@ +#ifndef _LTRACE_H_ +#define _LTRACE_H_ + typedef enum Event_type Event_type; enum Event_type { EVENT_NONE=0, @@ -38,3 +41,5 @@ typedef void (*callback_func) (Event *); extern void ltrace_init(int argc, char **argv); extern void ltrace_add_callback(callback_func f, Event_type type); extern void ltrace_main(void); + +#endif /* _LTRACE_H_ */ @@ -9,6 +9,7 @@ #include <unistd.h> #include "common.h" +#include "proc.h" /* TODO FIXME XXX: include in common.h: */ extern struct timeval current_time_spent; @@ -15,6 +15,7 @@ #include "common.h" #include "breakpoint.h" +#include "proc.h" Process * open_program(char *filename, pid_t pid, int enable) { @@ -292,7 +293,7 @@ remove_process(Process *proc) } void -install_event_handler(Process * proc, Event_Handler * handler) +install_event_handler(Process *proc, struct event_handler *handler) { debug(DEBUG_FUNCTION, "install_event_handler(pid=%d, %p)", proc->pid, handler); assert(proc->event_handler == NULL); @@ -302,7 +303,7 @@ install_event_handler(Process * proc, Event_Handler * handler) void destroy_event_handler(Process * proc) { - Event_Handler * handler = proc->event_handler; + struct event_handler *handler = proc->event_handler; debug(DEBUG_FUNCTION, "destroy_event_handler(pid=%d, %p)", proc->pid, handler); assert(handler != NULL); if (handler->destroy != NULL) @@ -0,0 +1,121 @@ +#ifndef _PROC_H_ +#define _PROC_H_ + +#if defined(HAVE_LIBUNWIND) +# include <libunwind.h> +#endif /* defined(HAVE_LIBUNWIND) */ + +#include "ltrace.h" +#include "dict.h" + +struct event_handler { + /* Event handler that overrides the default one. Should + * return NULL if the event was handled, otherwise the + * returned event is passed to the default handler. */ + Event *(*on_event)(struct event_handler *self, Event *event); + + /* Called when the event handler removal is requested. */ + void (*destroy)(struct event_handler *self); +}; + +enum process_state { + STATE_ATTACHED = 0, + STATE_BEING_CREATED, + STATE_IGNORED /* ignore this process (it's a fork and no -f was used) */ +}; + +enum pcb_status { + pcb_stop, /* The iteration should stop. */ + pcb_cont, /* The iteration should continue. */ +}; + +struct callstack_element { + union { + int syscall; + struct library_symbol * libfunc; + } c_un; + int is_syscall; + void * return_addr; + struct timeval time_spent; + void * arch_ptr; +}; + +/* XXX We should get rid of this. */ +#define MAX_CALLDEPTH 64 + +/* XXX We would rather have this all organized a little differently, + * have Process for the whole group and Task for what's there for + * per-thread stuff. But for now this is the less invasive way of + * structuring it. */ +struct Process { + enum process_state state; + Process * parent; /* needed by STATE_BEING_CREATED */ + char * filename; + pid_t pid; + + /* Dictionary of breakpoints (which is a mapping + * address->breakpoint). This is NULL for non-leader + * processes. */ + Dict * breakpoints; + + int mask_32bit; /* 1 if 64-bit ltrace is tracing 32-bit process */ + unsigned int personality; + int tracesysgood; /* signal indicating a PTRACE_SYSCALL trap */ + + int callstack_depth; + struct callstack_element callstack[MAX_CALLDEPTH]; + struct library_symbol * list_of_symbols; + + int libdl_hooked; + /* Arch-dependent: */ + void * debug; /* arch-dep process debug struct */ + long debug_state; /* arch-dep debug state */ + void * instruction_pointer; + void * stack_pointer; /* To get return addr, args... */ + void * return_addr; + void * arch_ptr; + short e_machine; + short need_to_reinitialize_breakpoints; +#ifdef __arm__ + int thumb_mode; /* ARM execution mode: 0: ARM, 1: Thumb */ +#endif + +#if defined(HAVE_LIBUNWIND) + /* libunwind address space */ + unw_addr_space_t unwind_as; + void *unwind_priv; +#endif /* defined(HAVE_LIBUNWIND) */ + + /* Set in leader. */ + struct event_handler *event_handler; + + /** + * Process chaining. + **/ + Process * next; + + /* LEADER points to the leader thread of the POSIX.1 process. + If X->LEADER == X, then X is the leader thread and the + Process structures chained by NEXT represent other threads, + up until, but not including, the next leader thread. + LEADER may be NULL after the leader has already exited. In + that case this process is waiting to be collected. */ + Process * leader; +}; + +Process * open_program(char *filename, pid_t pid, int init_breakpoints); +void open_pid(pid_t pid); +Process * pid2proc(pid_t pid); +Process *each_process(Process *start, + enum pcb_status (* cb)(Process *proc, void *data), + void *data); +Process *each_task(Process *start, + enum pcb_status (* cb)(Process *proc, void *data), + void *data); +void add_process(Process *proc); +void change_process_leader(Process *proc, Process *leader); +void remove_process(Process *proc); +void install_event_handler(Process *proc, struct event_handler *handler); +void destroy_event_handler(Process *proc); + +#endif /* _PROC_H_ */ diff --git a/sysdeps/linux-gnu/alpha/plt.c b/sysdeps/linux-gnu/alpha/plt.c index 83337b2..8ef456e 100644 --- a/sysdeps/linux-gnu/alpha/plt.c +++ b/sysdeps/linux-gnu/alpha/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" GElf_Addr diff --git a/sysdeps/linux-gnu/alpha/regs.c b/sysdeps/linux-gnu/alpha/regs.c index 9554e48..3c02a5d 100644 --- a/sysdeps/linux-gnu/alpha/regs.c +++ b/sysdeps/linux-gnu/alpha/regs.c @@ -4,6 +4,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/alpha/trace.c b/sysdeps/linux-gnu/alpha/trace.c index e4d4063..18fe395 100644 --- a/sysdeps/linux-gnu/alpha/trace.c +++ b/sysdeps/linux-gnu/alpha/trace.c @@ -6,6 +6,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #include "debug.h" diff --git a/sysdeps/linux-gnu/arm/plt.c b/sysdeps/linux-gnu/arm/plt.c index 76f4f4c..fb98d7b 100644 --- a/sysdeps/linux-gnu/arm/plt.c +++ b/sysdeps/linux-gnu/arm/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" static int diff --git a/sysdeps/linux-gnu/arm/regs.c b/sysdeps/linux-gnu/arm/regs.c index b8aed6e..ea4d3a6 100644 --- a/sysdeps/linux-gnu/arm/regs.c +++ b/sysdeps/linux-gnu/arm/regs.c @@ -4,6 +4,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c index 39b8264..f465b72 100644 --- a/sysdeps/linux-gnu/arm/trace.c +++ b/sysdeps/linux-gnu/arm/trace.c @@ -7,6 +7,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #include "output.h" #include "ptrace.h" diff --git a/sysdeps/linux-gnu/breakpoint.c b/sysdeps/linux-gnu/breakpoint.c index b98374b..58eac8d 100644 --- a/sysdeps/linux-gnu/breakpoint.c +++ b/sysdeps/linux-gnu/breakpoint.c @@ -6,6 +6,7 @@ #include "common.h" #include "arch.h" #include "breakpoint.h" +#include "proc.h" #ifdef ARCH_HAVE_ENABLE_BREAKPOINT extern void arch_enable_breakpoint(pid_t, struct breakpoint *); diff --git a/sysdeps/linux-gnu/cris/plt.c b/sysdeps/linux-gnu/cris/plt.c index 46367b8..df2dc02 100644 --- a/sysdeps/linux-gnu/cris/plt.c +++ b/sysdeps/linux-gnu/cris/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" GElf_Addr arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) diff --git a/sysdeps/linux-gnu/cris/regs.c b/sysdeps/linux-gnu/cris/regs.c index b78734c..a2dddf1 100644 --- a/sysdeps/linux-gnu/cris/regs.c +++ b/sysdeps/linux-gnu/cris/regs.c @@ -6,6 +6,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/cris/trace.c b/sysdeps/linux-gnu/cris/trace.c index b9439fc..b2b1ba8 100644 --- a/sysdeps/linux-gnu/cris/trace.c +++ b/sysdeps/linux-gnu/cris/trace.c @@ -9,6 +9,7 @@ #include <asm/ptrace.h> #include <elf.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/events.c b/sysdeps/linux-gnu/events.c index 0167049..9c376f3 100644 --- a/sysdeps/linux-gnu/events.c +++ b/sysdeps/linux-gnu/events.c @@ -13,6 +13,7 @@ #include "common.h" #include "breakpoint.h" +#include "proc.h" static Event event; diff --git a/sysdeps/linux-gnu/i386/plt.c b/sysdeps/linux-gnu/i386/plt.c index b53ff44..8b0fc46 100644 --- a/sysdeps/linux-gnu/i386/plt.c +++ b/sysdeps/linux-gnu/i386/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" GElf_Addr diff --git a/sysdeps/linux-gnu/i386/regs.c b/sysdeps/linux-gnu/i386/regs.c index 6777f17..a1584ac 100644 --- a/sysdeps/linux-gnu/i386/regs.c +++ b/sysdeps/linux-gnu/i386/regs.c @@ -4,7 +4,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> -#include "common.h" +#include "proc.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) # define PTRACE_PEEKUSER PTRACE_PEEKUSR diff --git a/sysdeps/linux-gnu/i386/trace.c b/sysdeps/linux-gnu/i386/trace.c index 76f1105..451f4d1 100644 --- a/sysdeps/linux-gnu/i386/trace.c +++ b/sysdeps/linux-gnu/i386/trace.c @@ -7,6 +7,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/ia64/plt.c b/sysdeps/linux-gnu/ia64/plt.c index 7fd451b..323df65 100644 --- a/sysdeps/linux-gnu/ia64/plt.c +++ b/sysdeps/linux-gnu/ia64/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" /* A bundle is 128 bits */ diff --git a/sysdeps/linux-gnu/ia64/regs.c b/sysdeps/linux-gnu/ia64/regs.c index 3f5d951..64c0164 100644 --- a/sysdeps/linux-gnu/ia64/regs.c +++ b/sysdeps/linux-gnu/ia64/regs.c @@ -8,6 +8,7 @@ #include <asm/rse.h> #include <stddef.h> +#include "proc.h" #include "common.h" void * diff --git a/sysdeps/linux-gnu/ia64/trace.c b/sysdeps/linux-gnu/ia64/trace.c index 079ed55..385fac1 100644 --- a/sysdeps/linux-gnu/ia64/trace.c +++ b/sysdeps/linux-gnu/ia64/trace.c @@ -11,6 +11,7 @@ #include <asm/rse.h> #include <errno.h> +#include "proc.h" #include "common.h" /* What we think of as a bundle, ptrace thinks of it as two unsigned diff --git a/sysdeps/linux-gnu/m68k/plt.c b/sysdeps/linux-gnu/m68k/plt.c index 508d7fc..a1c2604 100644 --- a/sysdeps/linux-gnu/m68k/plt.c +++ b/sysdeps/linux-gnu/m68k/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" GElf_Addr diff --git a/sysdeps/linux-gnu/m68k/regs.c b/sysdeps/linux-gnu/m68k/regs.c index 959a60e..1542b5a 100644 --- a/sysdeps/linux-gnu/m68k/regs.c +++ b/sysdeps/linux-gnu/m68k/regs.c @@ -4,6 +4,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/m68k/trace.c b/sysdeps/linux-gnu/m68k/trace.c index 2f89fdf..c63702d 100644 --- a/sysdeps/linux-gnu/m68k/trace.c +++ b/sysdeps/linux-gnu/m68k/trace.c @@ -6,6 +6,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/mipsel/plt.c b/sysdeps/linux-gnu/mipsel/plt.c index 57dfb9a..86f7cb4 100644 --- a/sysdeps/linux-gnu/mipsel/plt.c +++ b/sysdeps/linux-gnu/mipsel/plt.c @@ -1,6 +1,7 @@ #include "debug.h" #include <gelf.h> #include <sys/ptrace.h> +#include "proc.h" #include "common.h" /** diff --git a/sysdeps/linux-gnu/mipsel/regs.c b/sysdeps/linux-gnu/mipsel/regs.c index badbb10..a8a9b10 100644 --- a/sysdeps/linux-gnu/mipsel/regs.c +++ b/sysdeps/linux-gnu/mipsel/regs.c @@ -5,6 +5,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #include "mipsel.h" diff --git a/sysdeps/linux-gnu/mipsel/trace.c b/sysdeps/linux-gnu/mipsel/trace.c index 6553967..4b999e4 100644 --- a/sysdeps/linux-gnu/mipsel/trace.c +++ b/sysdeps/linux-gnu/mipsel/trace.c @@ -6,6 +6,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> #include "debug.h" +#include "proc.h" #include "common.h" #include "mipsel.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c index 668f63d..70bc19b 100644 --- a/sysdeps/linux-gnu/ppc/plt.c +++ b/sysdeps/linux-gnu/ppc/plt.c @@ -1,5 +1,6 @@ #include <gelf.h> #include <sys/ptrace.h> +#include "proc.h" #include "common.h" GElf_Addr diff --git a/sysdeps/linux-gnu/ppc/regs.c b/sysdeps/linux-gnu/ppc/regs.c index eca58ff..370e1de 100644 --- a/sysdeps/linux-gnu/ppc/regs.c +++ b/sysdeps/linux-gnu/ppc/regs.c @@ -4,6 +4,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c index 05993de..c6485c5 100644 --- a/sysdeps/linux-gnu/ppc/trace.c +++ b/sysdeps/linux-gnu/ppc/trace.c @@ -9,6 +9,7 @@ #include <errno.h> #include <string.h> +#include "proc.h" #include "common.h" #include "ptrace.h" diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c index 3350117..eba030f 100644 --- a/sysdeps/linux-gnu/proc.c +++ b/sysdeps/linux-gnu/proc.c @@ -18,6 +18,7 @@ #include "common.h" #include "breakpoint.h" +#include "proc.h" /* /proc/pid doesn't exist just after the fork, and sometimes `ltrace' * couldn't open it to find the executable. So it may be necessary to diff --git a/sysdeps/linux-gnu/s390/plt.c b/sysdeps/linux-gnu/s390/plt.c index 85a1dd1..754d270 100644 --- a/sysdeps/linux-gnu/s390/plt.c +++ b/sysdeps/linux-gnu/s390/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" GElf_Addr diff --git a/sysdeps/linux-gnu/s390/regs.c b/sysdeps/linux-gnu/s390/regs.c index 169893e..a45dd9b 100644 --- a/sysdeps/linux-gnu/s390/regs.c +++ b/sysdeps/linux-gnu/s390/regs.c @@ -9,6 +9,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/s390/trace.c b/sysdeps/linux-gnu/s390/trace.c index 63935de..8c08f1f 100644 --- a/sysdeps/linux-gnu/s390/trace.c +++ b/sysdeps/linux-gnu/s390/trace.c @@ -17,6 +17,7 @@ #include <sys/ptrace.h> #include <asm/ptrace.h> +#include "proc.h" #include "common.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) diff --git a/sysdeps/linux-gnu/sparc/plt.c b/sysdeps/linux-gnu/sparc/plt.c index f9e6d80..658e549 100644 --- a/sysdeps/linux-gnu/sparc/plt.c +++ b/sysdeps/linux-gnu/sparc/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" GElf_Addr diff --git a/sysdeps/linux-gnu/sparc/regs.c b/sysdeps/linux-gnu/sparc/regs.c index 49d2729..d7ee114 100644 --- a/sysdeps/linux-gnu/sparc/regs.c +++ b/sysdeps/linux-gnu/sparc/regs.c @@ -2,6 +2,7 @@ #include <sys/types.h> #include "ptrace.h" +#include "proc.h" #include "common.h" void * diff --git a/sysdeps/linux-gnu/sparc/trace.c b/sysdeps/linux-gnu/sparc/trace.c index 7f05b55..e05c4d3 100644 --- a/sysdeps/linux-gnu/sparc/trace.c +++ b/sysdeps/linux-gnu/sparc/trace.c @@ -6,6 +6,7 @@ #include <signal.h> #include <string.h> #include "ptrace.h" +#include "proc.h" #include "common.h" void diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c index fe64a28..6c6e814 100644 --- a/sysdeps/linux-gnu/trace.c +++ b/sysdeps/linux-gnu/trace.c @@ -17,6 +17,7 @@ #include "ptrace.h" #include "common.h" #include "breakpoint.h" +#include "proc.h" /* If the system headers did not provide the constants, hard-code the normal values. */ @@ -242,7 +243,7 @@ struct pid_set { */ struct process_stopping_handler { - Event_Handler super; + struct event_handler super; /* The task that is doing the re-enablement. */ Process * task_enabling_breakpoint; @@ -341,7 +342,7 @@ task_blocked(Process * task, void * data) return task_stopped(task, NULL); } -static Event * process_vfork_on_event(Event_Handler * super, Event * event); +static Event *process_vfork_on_event(struct event_handler *super, Event *event); static enum pcb_status task_vforked(Process * task, void * data) @@ -703,7 +704,7 @@ singlestep_error(struct process_stopping_handler *self, Event **eventp) * happens, we let the re-enablement thread to PTRACE_SINGLESTEP, * re-enable, and continue everyone. */ static Event * -process_stopping_on_event(Event_Handler * super, Event * event) +process_stopping_on_event(struct event_handler *super, Event *event) { struct process_stopping_handler * self = (void *)super; Process * task = event->proc; @@ -812,7 +813,7 @@ process_stopping_on_event(Event_Handler * super, Event * event) } static void -process_stopping_destroy(Event_Handler * super) +process_stopping_destroy(struct event_handler *super) { struct process_stopping_handler * self = (void *)super; free(self->pids.tasks); @@ -872,12 +873,12 @@ continue_after_breakpoint(Process *proc, struct breakpoint *sbp) */ struct ltrace_exiting_handler { - Event_Handler super; + struct event_handler super; struct pid_set pids; }; static Event * -ltrace_exiting_on_event(Event_Handler * super, Event * event) +ltrace_exiting_on_event(struct event_handler *super, Event *event) { struct ltrace_exiting_handler * self = (void *)super; Process * task = event->proc; @@ -904,7 +905,7 @@ ltrace_exiting_on_event(Event_Handler * super, Event * event) } static void -ltrace_exiting_destroy(Event_Handler * super) +ltrace_exiting_destroy(struct event_handler *super) { struct ltrace_exiting_handler * self = (void *)super; free(self->pids.tasks); @@ -975,12 +976,12 @@ ltrace_exiting_install_handler(Process * proc) struct process_vfork_handler { - Event_Handler super; + struct event_handler super; void * bp_addr; }; static Event * -process_vfork_on_event(Event_Handler * super, Event * event) +process_vfork_on_event(struct event_handler *super, Event *event) { struct process_vfork_handler * self = (void *)super; struct breakpoint *sbp; diff --git a/sysdeps/linux-gnu/x86_64/plt.c b/sysdeps/linux-gnu/x86_64/plt.c index b53ff44..8b0fc46 100644 --- a/sysdeps/linux-gnu/x86_64/plt.c +++ b/sysdeps/linux-gnu/x86_64/plt.c @@ -1,4 +1,5 @@ #include <gelf.h> +#include "proc.h" #include "common.h" GElf_Addr diff --git a/sysdeps/linux-gnu/x86_64/regs.c b/sysdeps/linux-gnu/x86_64/regs.c index ed1f118..0ff3281 100644 --- a/sysdeps/linux-gnu/x86_64/regs.c +++ b/sysdeps/linux-gnu/x86_64/regs.c @@ -4,7 +4,7 @@ #include <sys/ptrace.h> #include <sys/reg.h> -#include "common.h" +#include "proc.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) # define PTRACE_PEEKUSER PTRACE_PEEKUSR diff --git a/sysdeps/linux-gnu/x86_64/trace.c b/sysdeps/linux-gnu/x86_64/trace.c index d0299d9..0267c1d 100644 --- a/sysdeps/linux-gnu/x86_64/trace.c +++ b/sysdeps/linux-gnu/x86_64/trace.c @@ -12,6 +12,7 @@ #include "common.h" #include "ptrace.h" +#include "proc.h" #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) # define PTRACE_PEEKUSER PTRACE_PEEKUSR |