aboutsummaryrefslogtreecommitdiff
path: root/handle_event.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-04-23 18:05:24 +0200
committerPetr Machata <pmachata@redhat.com>2012-04-23 18:05:24 +0200
commita32ef7cbde9315c3993181d6f470b8c5d98e8d42 (patch)
tree73ba758915455f1fb0eaa71ce14fbf46307e93b3 /handle_event.c
parent02a41a5a996ffb774078cafe6311150720d2fd5b (diff)
downloadltrace-a32ef7cbde9315c3993181d6f470b8c5d98e8d42.tar.gz
Don't build fake library for system calls
At least not this way, the idea itself is still attractive.
Diffstat (limited to 'handle_event.c')
-rw-r--r--handle_event.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/handle_event.c b/handle_event.c
index 507a703..5de61a6 100644
--- a/handle_event.c
+++ b/handle_event.c
@@ -388,43 +388,28 @@ handle_exit_signal(Event *event) {
free(event->proc);
}
-static struct library_symbol *
-temporary_syscall_symbol(const char *name)
+static void
+output_syscall(struct Process *proc, const char *name,
+ void (*output)(enum tof, struct Process *,
+ struct library_symbol *))
{
- struct library *syscalls = malloc(sizeof(*syscalls));
- struct library_symbol *syscall = malloc(sizeof(*syscall));
- if (syscalls == NULL || syscall == NULL) {
- free(syscalls);
- free(syscall);
- return NULL;
- }
- /* XXX TODO: this needs to be fleshed out. */
- library_init(syscalls, (enum library_type)-1);
- library_set_soname(syscalls, "SYS", 0);
- if (library_symbol_init(syscall, 0, name, 0, LS_TOPLT_NONE) < 0)
- abort();
- library_add_symbol(syscalls, syscall);
- return syscall;
+ struct library_symbol syscall;
+ if (library_symbol_init(&syscall, 0, name, 0, LS_TOPLT_NONE) >= 0) {
+ (*output)(LT_TOF_SYSCALL, proc, &syscall);
+ library_symbol_destroy(&syscall);
+ }
}
static void
output_syscall_left(struct Process *proc, const char *name)
{
- struct library_symbol *syscall = temporary_syscall_symbol(name);
- output_left(LT_TOF_SYSCALL, proc, syscall);
- struct library *lib = syscall->lib;
- library_destroy(lib);
- free(lib);
+ output_syscall(proc, name, &output_left);
}
static void
output_syscall_right(struct Process *proc, const char *name)
{
- struct library_symbol *syscall = temporary_syscall_symbol(name);
- output_right(LT_TOF_SYSCALLR, proc, syscall);
- struct library *lib = syscall->lib;
- library_destroy(lib);
- free(lib);
+ output_syscall(proc, name, &output_right);
}
static void