Add expr.c, expr.h, plug in properly
- in callstack_pop, we don't free arch_ptr. That's because this doesn't
get copied over the clone. It's a mere coincidence that fork() doesn't
need to save register arguments, and this works.
- added copyright notices to files that this touches. This is based on
git blame. Only contributors of 10+ lines are added
- test suite adjusted to not include "void" type as "don't show this int".
Back ends in general need to know the exact type, so this never worked
anyway.
diff --git a/proc.c b/proc.c
index 3e6d5cb..7672ae8 100644
--- a/proc.c
+++ b/proc.c
@@ -282,16 +282,38 @@
.error = 0,
};
dict_apply_to_all(proc->breakpoints, &clone_single_bp, &data);
+ if (data.error < 0)
+ goto fail2;
/* And finally the call stack. */
memcpy(retp->callstack, proc->callstack, sizeof(retp->callstack));
retp->callstack_depth = proc->callstack_depth;
- if (data.error < 0)
- goto fail2;
+ size_t i;
+ for (i = 0; i < retp->callstack_depth; ++i) {
+ struct value_dict *args = retp->callstack[i].arguments;
+ if (args != NULL) {
+ fail3:
+ struct value_dict *nargs = malloc(sizeof(*nargs));
+ fprintf(stderr, "{A:%p->%p}", args, nargs);
+ if (nargs == NULL
+ || val_dict_clone(nargs, args) < 0) {
+
+ int j;
+ for (j = 0; j < i; ++j) {
+ nargs = p->callstack[i].arguments;
+ val_dict_destroy(nargs);
+ free(nargs);
+ p->callstack[i].arguments = NULL;
+ }
+ goto fail2;
+ }
+ retp->callstack[i].arguments = nargs;
+ }
+ }
if (arch_process_clone(retp, proc) < 0)
- goto fail2;
+ goto fail3;
return 0;
}