diff options
author | Petr Machata <pmachata@redhat.com> | 2012-01-05 18:07:02 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-08-29 19:02:05 +0200 |
commit | 94078ecce3a103c28457e6f90f1e5b0dacc61146 (patch) | |
tree | 2067fe27ceac9f9cf166bd523f96e3a8e5e1d891 /proc.c | |
parent | 000e31195ad4ad30a0c80c93ab57a424e7d8d918 (diff) | |
download | ltrace-94078ecce3a103c28457e6f90f1e5b0dacc61146.tar.gz |
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.
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -282,16 +282,38 @@ process_clone(struct Process *retp, struct Process *proc, pid_t pid) .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; } |