aboutsummaryrefslogtreecommitdiff
path: root/handle_event.c
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-10-26 22:21:59 +0200
committerPetr Machata <pmachata@redhat.com>2012-10-26 22:21:59 +0200
commite655ccffc4ba7bba317b01700f8fc50461d8c4dd (patch)
tree2497e8cc32070f5d25bd815386fbe2b7e11faff2 /handle_event.c
parent8978a1f7e605a876ce186479175dcfebc7362045 (diff)
downloadltrace-e655ccffc4ba7bba317b01700f8fc50461d8c4dd.tar.gz
Move stack entry cleanup to callstack_pop
At the same time publish that function. Eventually the whole push/pop logic should be moved to a separate module.
Diffstat (limited to 'handle_event.c')
-rw-r--r--handle_event.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/handle_event.c b/handle_event.c
index 5793d7f..42a7a05 100644
--- a/handle_event.c
+++ b/handle_event.c
@@ -57,7 +57,10 @@ static void handle_new(Event *event);
static void callstack_push_syscall(Process *proc, int sysnum);
static void callstack_push_symfunc(Process *proc,
struct library_symbol *sym);
-static void callstack_pop(Process *proc);
+/* XXX Stack maintenance should be moved to a dedicated module, or to
+ * proc.c, and push/pop should be visible outside this module. For
+ * now, because we need this in proc.c, this is non-static. */
+void callstack_pop(struct Process *proc);
static char * shortsignal(Process *proc, int signum);
static char * sysname(Process *proc, int sysnum);
@@ -730,16 +733,24 @@ callstack_push_symfunc(Process *proc, struct library_symbol *sym) {
}
}
-static void
-callstack_pop(Process *proc) {
+void
+callstack_pop(struct Process *proc)
+{
struct callstack_element *elem;
assert(proc->callstack_depth > 0);
debug(DEBUG_FUNCTION, "callstack_pop(pid=%d)", proc->pid);
elem = &proc->callstack[proc->callstack_depth - 1];
- if (!elem->is_syscall && elem->return_addr) {
- assert(proc->leader != NULL);
+ if (!elem->is_syscall && elem->return_addr)
delete_breakpoint(proc, elem->return_addr);
+
+ if (elem->fetch_context != NULL)
+ fetch_arg_done(elem->fetch_context);
+
+ if (elem->arguments != NULL) {
+ val_dict_destroy(elem->arguments);
+ free(elem->arguments);
}
+
proc->callstack_depth--;
}