mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 04:29:49 +00:00
2005-02-07 Andrew Cagney <cagney@gnu.org>
* value.h (value_embedded_offset): Delete. (value_embedded_offset): Declare. * value.c (value_embedded_offset): Define. * valops.c, p-valprint.c, mi/mi-main.c, hpacc-abi.c: Update. * gnu-v3-abi.c, eval.c, c-valprint.c, cp-valprint.c: Update. * cp-abi.h: Update.
This commit is contained in:
parent
c4cf382105
commit
13c3b5f5bb
@ -1,5 +1,12 @@
|
||||
2005-02-07 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* value.h (value_embedded_offset): Delete.
|
||||
(value_embedded_offset): Declare.
|
||||
* value.c (value_embedded_offset): Define.
|
||||
* valops.c, p-valprint.c, mi/mi-main.c, hpacc-abi.c: Update.
|
||||
* gnu-v3-abi.c, eval.c, c-valprint.c, cp-valprint.c: Update.
|
||||
* cp-abi.h: Update.
|
||||
|
||||
* value.h (VALUE_LAZY): Delete
|
||||
(set_value_lazy): Declare.
|
||||
* value.c (set_value_lazy): Define.
|
||||
|
@ -598,7 +598,7 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
|
||||
}
|
||||
|
||||
return val_print (type, value_contents_all (val),
|
||||
VALUE_EMBEDDED_OFFSET (val),
|
||||
value_embedded_offset (val),
|
||||
VALUE_ADDRESS (val) + value_offset (val),
|
||||
stream, format, 1, 0, pretty);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ extern struct value *value_virtual_fn_field (struct value **valuep,
|
||||
of the complete object to the start of the embedded subobject
|
||||
VALUE represents. In other words, the enclosing object starts
|
||||
at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
|
||||
VALUE_EMBEDDED_OFFSET (VALUE) + *TOP
|
||||
value_embedded_offset (VALUE) + *TOP
|
||||
- If *USING_ENC is non-zero, then *TOP is the offset from the
|
||||
address of the complete object to the enclosing object stored
|
||||
in VALUE. In other words, the enclosing object starts at
|
||||
|
@ -665,12 +665,12 @@ cp_print_static_field (struct type *type,
|
||||
|
||||
CHECK_TYPEDEF (type);
|
||||
cp_print_value_fields (type, type, value_contents_all (val),
|
||||
VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
|
||||
value_embedded_offset (val), VALUE_ADDRESS (val),
|
||||
stream, format, recurse, pretty, NULL, 1);
|
||||
return;
|
||||
}
|
||||
val_print (type, value_contents_all (val),
|
||||
VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
|
||||
value_embedded_offset (val), VALUE_ADDRESS (val),
|
||||
stream, format, 0, recurse, pretty);
|
||||
}
|
||||
|
||||
|
@ -1148,7 +1148,7 @@ evaluate_subexp_standard (struct type *expect_type,
|
||||
reflect any ``this'' changes. */
|
||||
arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
|
||||
VALUE_ADDRESS (temp) + value_offset (temp)
|
||||
+ VALUE_EMBEDDED_OFFSET (temp));
|
||||
+ value_embedded_offset (temp));
|
||||
argvec[1] = arg2; /* the ``this'' pointer */
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ gnuv3_rtti_type (struct value *value,
|
||||
vtable_symbol
|
||||
= lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable)
|
||||
+ value_offset (vtable)
|
||||
+ VALUE_EMBEDDED_OFFSET (vtable));
|
||||
+ value_embedded_offset (vtable));
|
||||
if (! vtable_symbol)
|
||||
return NULL;
|
||||
|
||||
@ -265,7 +265,7 @@ gnuv3_rtti_type (struct value *value,
|
||||
= value_as_long (value_field (vtable, vtable_field_offset_to_top));
|
||||
|
||||
if (full_p)
|
||||
*full_p = (- offset_to_top == VALUE_EMBEDDED_OFFSET (value)
|
||||
*full_p = (- offset_to_top == value_embedded_offset (value)
|
||||
&& (TYPE_LENGTH (value_enclosing_type (value))
|
||||
>= TYPE_LENGTH (run_time_type)));
|
||||
if (top_p)
|
||||
|
@ -104,7 +104,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
|
||||
/* pai: FIXME -- 32x64 possible problem? */
|
||||
/* First word (4 bytes) in object layout is the vtable pointer */
|
||||
coreptr = *(CORE_ADDR *) (value_contents (argp)); /* pai: (temp) */
|
||||
/* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
|
||||
/* + offset + value_embedded_offset (argp)); */
|
||||
|
||||
if (!coreptr)
|
||||
error
|
||||
@ -223,7 +223,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
|
||||
+ value_offset (v)
|
||||
+ (using_enclosing
|
||||
? 0
|
||||
: VALUE_EMBEDDED_OFFSET (v)));
|
||||
: value_embedded_offset (v)));
|
||||
if (coreptr == 0)
|
||||
/* return silently -- maybe called on gdb-generated value */
|
||||
return NULL;
|
||||
@ -278,7 +278,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
|
||||
||
|
||||
/* Or we checked on the embedded object and top offset was the
|
||||
same as the embedded offset */
|
||||
((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
|
||||
((top_offset == value_embedded_offset (v)) &&
|
||||
!using_enclosing &&
|
||||
TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
|
||||
|
||||
|
@ -680,7 +680,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
|
||||
|
||||
/* Print the result of the expression evaluation. */
|
||||
val_print (value_type (val), value_contents (val),
|
||||
VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
|
||||
value_embedded_offset (val), VALUE_ADDRESS (val),
|
||||
stb->stream, 0, 0, 0, 0);
|
||||
|
||||
ui_out_field_stream (uiout, "value", stb);
|
||||
|
@ -565,7 +565,7 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format,
|
||||
fprintf_filtered (stream, ") ");
|
||||
}
|
||||
}
|
||||
return val_print (type, value_contents (val), VALUE_EMBEDDED_OFFSET (val),
|
||||
return val_print (type, value_contents (val), value_embedded_offset (val),
|
||||
VALUE_ADDRESS (val) + value_offset (val),
|
||||
stream, format, 1, 0, pretty);
|
||||
}
|
||||
|
22
gdb/valops.c
22
gdb/valops.c
@ -398,7 +398,7 @@ value_cast (struct type *type, struct value *arg2)
|
||||
CORE_ADDR addr2 = value_as_address (arg2);
|
||||
addr2 -= (VALUE_ADDRESS (v)
|
||||
+ value_offset (v)
|
||||
+ VALUE_EMBEDDED_OFFSET (v));
|
||||
+ value_embedded_offset (v));
|
||||
return value_from_pointer (type, addr2);
|
||||
}
|
||||
}
|
||||
@ -544,7 +544,7 @@ value_assign (struct value *toval, struct value *fromval)
|
||||
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
|
||||
val = value_copy (VALUE_INTERNALVAR (toval)->value);
|
||||
val = value_change_enclosing_type (val, value_enclosing_type (fromval));
|
||||
VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
|
||||
set_value_embedded_offset (val, value_embedded_offset (fromval));
|
||||
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
|
||||
return val;
|
||||
|
||||
@ -732,7 +732,7 @@ value_assign (struct value *toval, struct value *fromval)
|
||||
TYPE_LENGTH (type));
|
||||
val->type = type;
|
||||
val = value_change_enclosing_type (val, value_enclosing_type (fromval));
|
||||
VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
|
||||
set_value_embedded_offset (val, value_embedded_offset (fromval));
|
||||
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
|
||||
|
||||
return val;
|
||||
@ -868,13 +868,13 @@ value_addr (struct value *arg1)
|
||||
arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
|
||||
(VALUE_ADDRESS (arg1)
|
||||
+ value_offset (arg1)
|
||||
+ VALUE_EMBEDDED_OFFSET (arg1)));
|
||||
+ value_embedded_offset (arg1)));
|
||||
|
||||
/* This may be a pointer to a base subobject; so remember the
|
||||
full derived object's type ... */
|
||||
arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (value_enclosing_type (arg1)));
|
||||
/* ... and also the relative position of the subobject in the full object */
|
||||
VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
|
||||
VALUE_POINTED_TO_OFFSET (arg2) = value_embedded_offset (arg1);
|
||||
return arg2;
|
||||
}
|
||||
|
||||
@ -914,7 +914,7 @@ value_ind (struct value *arg1)
|
||||
arg2->type = TYPE_TARGET_TYPE (base_type);
|
||||
/* Add embedding info */
|
||||
arg2 = value_change_enclosing_type (arg2, enc_type);
|
||||
VALUE_EMBEDDED_OFFSET (arg2) = VALUE_POINTED_TO_OFFSET (arg1);
|
||||
set_value_embedded_offset (arg2, VALUE_POINTED_TO_OFFSET (arg1));
|
||||
|
||||
/* We may be pointing to an object of some derived type */
|
||||
arg2 = value_full_object (arg2, NULL, 0, 0, 0);
|
||||
@ -1504,7 +1504,7 @@ search_struct_method (char *name, struct value **arg1p,
|
||||
int skip;
|
||||
find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
|
||||
value_contents_all (*arg1p),
|
||||
offset + VALUE_EMBEDDED_OFFSET (*arg1p),
|
||||
offset + value_embedded_offset (*arg1p),
|
||||
&base_offset, &skip);
|
||||
if (skip >= 0)
|
||||
error ("Virtual base class offset not found in vtable");
|
||||
@ -1738,7 +1738,7 @@ find_method_list (struct value **argp, char *method, int offset,
|
||||
int skip;
|
||||
find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
|
||||
value_contents_all (*argp),
|
||||
offset + VALUE_EMBEDDED_OFFSET (*argp),
|
||||
offset + value_embedded_offset (*argp),
|
||||
&base_offset, &skip);
|
||||
if (skip >= 0)
|
||||
error ("Virtual base class offset not found in vtable");
|
||||
@ -2624,9 +2624,11 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
|
||||
adjusting for the embedded offset of argp if that's what value_rtti_type
|
||||
used for its computation. */
|
||||
new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top +
|
||||
(using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp)));
|
||||
(using_enc ? 0 : value_embedded_offset (argp)));
|
||||
new_val->type = value_type (argp);
|
||||
VALUE_EMBEDDED_OFFSET (new_val) = using_enc ? top + VALUE_EMBEDDED_OFFSET (argp) : top;
|
||||
set_value_embedded_offset (new_val, (using_enc
|
||||
? top + value_embedded_offset (argp)
|
||||
: top));
|
||||
return new_val;
|
||||
}
|
||||
|
||||
|
24
gdb/value.c
24
gdb/value.c
@ -97,7 +97,7 @@ allocate_value (struct type *type)
|
||||
VALUE_REGNUM (val) = -1;
|
||||
val->lazy = 0;
|
||||
val->optimized_out = 0;
|
||||
VALUE_EMBEDDED_OFFSET (val) = 0;
|
||||
val->embedded_offset = 0;
|
||||
VALUE_POINTED_TO_OFFSET (val) = 0;
|
||||
val->modifiable = 1;
|
||||
return val;
|
||||
@ -210,6 +210,18 @@ set_value_optimized_out (struct value *value, int val)
|
||||
{
|
||||
value->optimized_out = val;
|
||||
}
|
||||
|
||||
int
|
||||
value_embedded_offset (struct value *value)
|
||||
{
|
||||
return value->embedded_offset;
|
||||
}
|
||||
|
||||
void
|
||||
set_value_embedded_offset (struct value *value, int val)
|
||||
{
|
||||
value->embedded_offset = val;
|
||||
}
|
||||
|
||||
/* Return a mark in the value chain. All values allocated after the
|
||||
mark is obtained (except for those released) are subject to being freed
|
||||
@ -315,7 +327,7 @@ value_copy (struct value *arg)
|
||||
VALUE_REGNUM (val) = VALUE_REGNUM (arg);
|
||||
val->lazy = arg->lazy;
|
||||
val->optimized_out = arg->optimized_out;
|
||||
VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg);
|
||||
val->embedded_offset = value_embedded_offset (arg);
|
||||
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg);
|
||||
val->modifiable = arg->modifiable;
|
||||
if (!value_lazy (val))
|
||||
@ -1005,10 +1017,8 @@ value_primitive_field (struct value *arg1, int offset,
|
||||
memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
|
||||
TYPE_LENGTH (value_enclosing_type (arg1)));
|
||||
v->offset = value_offset (arg1);
|
||||
VALUE_EMBEDDED_OFFSET (v)
|
||||
= offset +
|
||||
VALUE_EMBEDDED_OFFSET (arg1) +
|
||||
TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
|
||||
v->embedded_offset = (offset + value_embedded_offset (arg1)
|
||||
+ TYPE_FIELD_BITPOS (arg_type, fieldno) / 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1022,7 +1032,7 @@ value_primitive_field (struct value *arg1, int offset,
|
||||
value_contents_raw (arg1) + offset,
|
||||
TYPE_LENGTH (type));
|
||||
v->offset = (value_offset (arg1) + offset
|
||||
+ VALUE_EMBEDDED_OFFSET (arg1));
|
||||
+ value_embedded_offset (arg1));
|
||||
}
|
||||
VALUE_LVAL (v) = VALUE_LVAL (arg1);
|
||||
if (VALUE_LVAL (arg1) == lval_internalvar)
|
||||
|
@ -215,7 +215,8 @@ extern int value_fetch_lazy (struct value *val);
|
||||
#define VALUE_REGNUM(val) (val)->regnum
|
||||
extern int value_optimized_out (struct value *value);
|
||||
extern void set_value_optimized_out (struct value *value, int val);
|
||||
#define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
|
||||
extern int value_embedded_offset (struct value *value);
|
||||
extern void set_value_embedded_offset (struct value *value, int val);
|
||||
#define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)
|
||||
|
||||
/* Convert a REF to the object referenced. */
|
||||
|
Loading…
Reference in New Issue
Block a user