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