tizen 2.0
[external/ltrace.git] / ltrace.h
1 typedef enum Event_type Event_type;
2 enum Event_type {
3         EVENT_NONE=0,
4         EVENT_SIGNAL,
5         EVENT_EXIT,
6         EVENT_EXIT_SIGNAL,
7         EVENT_SYSCALL,
8         EVENT_SYSRET,
9         EVENT_ARCH_SYSCALL,
10         EVENT_ARCH_SYSRET,
11         EVENT_CLONE,
12         EVENT_EXEC,
13         EVENT_BREAKPOINT,
14         EVENT_LIBCALL,
15         EVENT_LIBRET,
16         EVENT_NEW,        /* in this case, proc is NULL */
17         EVENT_MAX
18 };
19
20 typedef struct Process Process;
21 typedef struct Event Event;
22 struct Event {
23         Process * proc;
24         Event_type type;
25         union {
26                 int ret_val;     /* EVENT_EXIT */
27                 int signum;      /* EVENT_SIGNAL, EVENT_EXIT_SIGNAL */
28                 int sysnum;      /* EVENT_SYSCALL, EVENT_SYSRET */
29                 void * brk_addr; /* EVENT_BREAKPOINT */
30                 int newpid;      /* EVENT_CLONE, EVENT_NEW */
31         } e_un;
32 };
33
34 typedef void (*callback_func) (Event *);
35
36 extern void ltrace_init(int argc, char **argv);
37 extern void ltrace_add_callback(callback_func f, Event_type type);
38 extern void ltrace_main(void);