diff options
author | Petr Machata <pmachata@redhat.com> | 2012-01-06 16:58:54 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-08-29 19:02:06 +0200 |
commit | f6ec08afb96292fd3c802c1f633d8de249664c72 (patch) | |
tree | d52d839f849f5c4723329e85662b44209bed228c /proc.c | |
parent | 37b73c0ab8cbcab4729df6d12f2dc846d4652310 (diff) | |
download | ltrace-f6ec08afb96292fd3c802c1f633d8de249664c72.tar.gz |
Add fetch.c/fetch.h, a module for fetching function arguments
- this is now a thin wrapper over gimme_arg, ideally the backends will
eventually use this right interface
- in display_args.c, strip one layer of pointer wrapping, which is now
done in output.c
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -291,11 +291,26 @@ process_clone(struct Process *retp, struct Process *proc, pid_t pid) size_t i; for (i = 0; i < retp->callstack_depth; ++i) { + struct fetch_context *ctx = retp->callstack[i].fetch_context; + if (ctx != NULL) { + struct fetch_context *nctx = fetch_arg_clone(p, ctx); + if (nctx == NULL) { + int j; + release1: + for (j = 0; j < i; ++j) { + nctx = retp->callstack[i].fetch_context; + fetch_arg_done(nctx); + retp->callstack[i].fetch_context = NULL; + } + goto fail2; + } + retp->callstack[i].fetch_context = nctx; + } + 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) { @@ -306,7 +321,12 @@ process_clone(struct Process *retp, struct Process *proc, pid_t pid) free(nargs); p->callstack[i].arguments = NULL; } - goto fail2; + + /* Pretend that this round went well, + * so that release1 frees I-th + * fetch_context. */ + ++i; + goto release1; } retp->callstack[i].arguments = nargs; } |