From b44d461b0ebcb9f30595e5c3e4c748775349ecf1 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 7 Feb 2005 20:17:28 +0000 Subject: [PATCH] 2005-02-07 Andrew Cagney * value.h (VALUE_POINTED_TO_OFFSET): Delete. (set_value_pointed_to_offset, value_pointed_to_offset): Declare. * value.c (set_value_pointed_to_offset): Define (value_pointed_to_offset): Define. * valops.c: Update. --- gdb/ChangeLog | 6 ++++++ gdb/valops.c | 12 ++++++------ gdb/value.c | 16 ++++++++++++++-- gdb/value.h | 3 ++- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d3e232ce25c..452aa1c9402 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2005-02-07 Andrew Cagney + * value.h (VALUE_POINTED_TO_OFFSET): Delete. + (set_value_pointed_to_offset, value_pointed_to_offset): Declare. + * value.c (set_value_pointed_to_offset): Define + (value_pointed_to_offset): Define. + * valops.c: Update. + * value.h (VALUE_EMBEDDED_OFFSET): Delete. (value_embedded_offset, set_value_embedded_offset): Declare. * value.c (value_embedded_offset): Define. diff --git a/gdb/valops.c b/gdb/valops.c index 502cfa647cd..942ef16a5f7 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -407,7 +407,7 @@ value_cast (struct type *type, struct value *arg2) } arg2->type = type; arg2 = value_change_enclosing_type (arg2, type); - VALUE_POINTED_TO_OFFSET (arg2) = 0; /* pai: chk_val */ + set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */ return arg2; } else if (VALUE_LVAL (arg2) == lval_memory) @@ -545,7 +545,7 @@ value_assign (struct value *toval, struct value *fromval) val = value_copy (VALUE_INTERNALVAR (toval)->value); val = value_change_enclosing_type (val, value_enclosing_type (fromval)); set_value_embedded_offset (val, value_embedded_offset (fromval)); - VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval); + set_value_pointed_to_offset (val, value_pointed_to_offset (fromval)); return val; case lval_internalvar_component: @@ -733,7 +733,7 @@ value_assign (struct value *toval, struct value *fromval) val->type = type; val = value_change_enclosing_type (val, value_enclosing_type (fromval)); set_value_embedded_offset (val, value_embedded_offset (fromval)); - VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval); + set_value_pointed_to_offset (val, value_pointed_to_offset (fromval)); return val; } @@ -874,7 +874,7 @@ value_addr (struct value *arg1) 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); + set_value_pointed_to_offset (arg2, value_embedded_offset (arg1)); return arg2; } @@ -909,12 +909,12 @@ value_ind (struct value *arg1) enc_type = TYPE_TARGET_TYPE (enc_type); /* Retrieve the enclosing object pointed to */ arg2 = value_at_lazy (enc_type, (value_as_address (arg1) - - VALUE_POINTED_TO_OFFSET (arg1))); + - value_pointed_to_offset (arg1))); /* Re-adjust type */ arg2->type = TYPE_TARGET_TYPE (base_type); /* Add embedding info */ arg2 = value_change_enclosing_type (arg2, enc_type); - set_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); diff --git a/gdb/value.c b/gdb/value.c index 11cc4bc20c0..4bc26ffaa25 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -98,7 +98,7 @@ allocate_value (struct type *type) val->lazy = 0; val->optimized_out = 0; val->embedded_offset = 0; - VALUE_POINTED_TO_OFFSET (val) = 0; + val->pointed_to_offset = 0; val->modifiable = 1; return val; } @@ -222,6 +222,18 @@ set_value_embedded_offset (struct value *value, int val) { value->embedded_offset = val; } + +int +value_pointed_to_offset (struct value *value) +{ + return value->pointed_to_offset; +} + +void +set_value_pointed_to_offset (struct value *value, int val) +{ + value->pointed_to_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 @@ -328,7 +340,7 @@ value_copy (struct value *arg) val->lazy = arg->lazy; val->optimized_out = arg->optimized_out; val->embedded_offset = value_embedded_offset (arg); - VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg); + val->pointed_to_offset = arg->pointed_to_offset; val->modifiable = arg->modifiable; if (!value_lazy (val)) { diff --git a/gdb/value.h b/gdb/value.h index 914bc64875f..d894252c4e4 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -217,7 +217,8 @@ extern int value_optimized_out (struct value *value); extern void set_value_optimized_out (struct value *value, int val); 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) +extern int value_pointed_to_offset (struct value *value); +extern void set_value_pointed_to_offset (struct value *value, int val); /* Convert a REF to the object referenced. */ -- 2.30.2