From 13c3b5f5bbe5ad8aed357e17db7e7922bfd253d7 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 7 Feb 2005 17:06:29 +0000 Subject: 2005-02-07 Andrew Cagney * 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. --- gdb/ChangeLog | 7 +++++++ gdb/c-valprint.c | 2 +- gdb/cp-abi.h | 2 +- gdb/cp-valprint.c | 4 ++-- gdb/eval.c | 2 +- gdb/gnu-v3-abi.c | 4 ++-- gdb/hpacc-abi.c | 6 +++--- gdb/mi/mi-main.c | 2 +- gdb/p-valprint.c | 2 +- gdb/valops.c | 22 ++++++++++++---------- gdb/value.c | 24 +++++++++++++++++------- gdb/value.h | 3 ++- 12 files changed, 50 insertions(+), 30 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2920e8..6eaeb47 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,12 @@ 2005-02-07 Andrew Cagney + * 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. diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 64f0f42..a18ef0f 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -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); } diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h index cf21a2f..cce41f0 100644 --- a/gdb/cp-abi.h +++ b/gdb/cp-abi.h @@ -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 diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 8624e25..42a07fc 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -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); } diff --git a/gdb/eval.c b/gdb/eval.c index 0bcfdf6..79a8ffd 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -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 */ } diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 12eea1b..f03ecba 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -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) diff --git a/gdb/hpacc-abi.c b/gdb/hpacc-abi.c index ff1d29d..9f86c15 100644 --- a/gdb/hpacc-abi.c +++ b/gdb/hpacc-abi.c @@ -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)))) diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 8afd262..cbfd2fe 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -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); diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index f3a9496..5291e4eb 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -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); } diff --git a/gdb/valops.c b/gdb/valops.c index 8aa4413..502cfa6 100644 --- a/gdb/valops.c +++ b/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; } diff --git a/gdb/value.c b/gdb/value.c index 0006a40..11cc4bc 100644 --- a/gdb/value.c +++ b/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) diff --git a/gdb/value.h b/gdb/value.h index ae17cd2..914bc64 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -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. */ -- cgit v1.1