diff options
author | Chanho Park <chanho61.park@samsung.com> | 2014-08-22 20:34:56 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-08-22 20:34:56 +0900 |
commit | 517f5529d7008eba87b8b2fee5ec9ec0a5075f6e (patch) | |
tree | c71720a9b41309713c089478f921165bd2d63b25 /value.c | |
parent | 689b9dbb8d7f88ab91e7741932ed000b6e49be9a (diff) | |
download | ltrace-517f5529d7008eba87b8b2fee5ec9ec0a5075f6e.tar.gz ltrace-517f5529d7008eba87b8b2fee5ec9ec0a5075f6e.tar.bz2 ltrace-517f5529d7008eba87b8b2fee5ec9ec0a5075f6e.zip |
Imported Upstream version 0.7.91upstream/0.7.91upstream
Diffstat (limited to 'value.c')
-rw-r--r-- | value.c | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -29,7 +29,7 @@ #include "backend.h" static void -value_common_init(struct value *valp, struct Process *inferior, +value_common_init(struct value *valp, struct process *inferior, struct value *parent, struct arg_type_info *type, int own_type) { @@ -43,7 +43,7 @@ value_common_init(struct value *valp, struct Process *inferior, } void -value_init(struct value *valp, struct Process *inferior, struct value *parent, +value_init(struct value *valp, struct process *inferior, struct value *parent, struct arg_type_info *type, int own_type) { assert(inferior != NULL); @@ -189,15 +189,30 @@ int value_clone(struct value *retp, const struct value *val) { *retp = *val; + + if (val->own_type) { + retp->type = malloc(sizeof(struct arg_type_info)); + if (type_clone (retp->type, val->type) < 0) { + free(retp->type); + return -1; + } + } + if (val->where == VAL_LOC_COPY) { assert(val->inferior != NULL); size_t size = type_sizeof(val->inferior, val->type); - if (size == (size_t)-1) + if (size == (size_t)-1) { + fail: + if (retp->own_type) { + type_destroy(retp->type); + free(retp->type); + } return -1; + } retp->u.address = malloc(size); if (retp->u.address == NULL) - return -1; + goto fail; memcpy(retp->u.address, val->u.address, size); } @@ -284,7 +299,7 @@ value_init_deref(struct value *ret_val, struct value *valp) /* We need "long" to be long enough to hold platform * pointers. */ - typedef char assert__long_enough_long[-(sizeof(l) < sizeof(void *))]; + (void)sizeof(char[1 - 2*(sizeof(l) < sizeof(void *))]); value_common_init(ret_val, valp->inferior, valp, valp->type->u.ptr_info.info, 0); |