aboutsummaryrefslogtreecommitdiff
path: root/ltrace.h
diff options
context:
space:
mode:
authorJuan Cespedes <cespedes@coco.thehackers.org>2009-07-03 11:55:44 +0200
committerJuan Cespedes <cespedes@coco.thehackers.org>2009-07-03 11:55:44 +0200
commit61da33723c5fb09762e38bd39a26ee15d62ffebc (patch)
treeebfece2b8b14d918468073e55b628165702ad753 /ltrace.h
parent8d1b92ba755f6d6229f5e230fc43d958b13836f8 (diff)
downloadltrace-61da33723c5fb09762e38bd39a26ee15d62ffebc.tar.gz
Added different callback handlers for each event
Diffstat (limited to 'ltrace.h')
-rw-r--r--ltrace.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/ltrace.h b/ltrace.h
index 9ba16a6..f918d8a 100644
--- a/ltrace.h
+++ b/ltrace.h
@@ -1,9 +1,6 @@
-typedef struct Process Process;
-typedef struct Event Event;
-struct Event {
- Process *proc;
- enum {
- EVENT_NONE,
+typedef enum Event_type Event_type;
+enum Event_type {
+ EVENT_NONE=0,
EVENT_SIGNAL,
EVENT_EXIT,
EVENT_EXIT_SIGNAL,
@@ -14,17 +11,26 @@ struct Event {
EVENT_CLONE,
EVENT_EXEC,
EVENT_BREAKPOINT,
- EVENT_NEW /* in this case, proc is NULL */
- } type;
+ EVENT_NEW, /* in this case, proc is NULL */
+ EVENT_MAX
+};
+
+typedef struct Process Process;
+typedef struct Event Event;
+struct Event {
+ Process * proc;
+ Event_type type;
union {
- int ret_val; /* EVENT_EXIT */
- int signum; /* EVENT_SIGNAL, EVENT_EXIT_SIGNAL */
- int sysnum; /* EVENT_SYSCALL, EVENT_SYSRET */
- void *brk_addr; /* EVENT_BREAKPOINT */
- int newpid; /* EVENT_CLONE, EVENT_NEW */
+ int ret_val; /* EVENT_EXIT */
+ int signum; /* EVENT_SIGNAL, EVENT_EXIT_SIGNAL */
+ int sysnum; /* EVENT_SYSCALL, EVENT_SYSRET */
+ void * brk_addr; /* EVENT_BREAKPOINT */
+ int newpid; /* EVENT_CLONE, EVENT_NEW */
} e_un;
};
+typedef void (*callback_func) (Event *);
+
extern void ltrace_init(int argc, char **argv);
-extern void ltrace_add_callback(void (*func)(Event *));
+extern void ltrace_add_callback(callback_func f, Event_type type);
extern void ltrace_main(void);