projects
/
platform
/
upstream
/
ltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added a disabled stub for complex float support
[platform/upstream/ltrace.git]
/
value.c
diff --git
a/value.c
b/value.c
index
f7950da
..
2125ba9
100644
(file)
--- a/
value.c
+++ b/
value.c
@@
-29,7
+29,7
@@
#include "backend.h"
static void
#include "backend.h"
static void
-value_common_init(struct value *valp, struct
P
rocess *inferior,
+value_common_init(struct value *valp, struct
p
rocess *inferior,
struct value *parent, struct arg_type_info *type,
int own_type)
{
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
}
void
-value_init(struct value *valp, struct
P
rocess *inferior, struct value *parent,
+value_init(struct value *valp, struct
p
rocess *inferior, struct value *parent,
struct arg_type_info *type, int own_type)
{
assert(inferior != NULL);
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;
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 (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;
return -1;
+ }
retp->u.address = malloc(size);
if (retp->u.address == NULL)
retp->u.address = malloc(size);
if (retp->u.address == NULL)
-
return -1
;
+
goto fail
;
memcpy(retp->u.address, val->u.address, size);
}
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. */
/* 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);
value_common_init(ret_val, valp->inferior, valp,
valp->type->u.ptr_info.info, 0);