diff options
author | Petr Machata <pmachata@redhat.com> | 2012-02-09 19:34:36 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-04-19 00:55:01 +0200 |
commit | 366c2f46d844f040458df9b7e35fc3b8527ed2d3 (patch) | |
tree | 0251a2089f4ffb07a62c8d2934bf0b80fd3fb41e /common.h | |
parent | 92acf752a592f7c4ce60d99914d9ccb59f8119eb (diff) | |
download | ltrace-366c2f46d844f040458df9b7e35fc3b8527ed2d3.tar.gz |
Move process-related functions and structures to proc.h
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 117 |
1 files changed, 0 insertions, 117 deletions
@@ -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); |