From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27939 invoked by alias); 7 Feb 2005 17:09:57 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27801 invoked from network); 7 Feb 2005 17:09:45 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 7 Feb 2005 17:09:45 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j17H9eE2014307 for ; Mon, 7 Feb 2005 12:09:45 -0500 Received: from localhost.redhat.com (vpn50-85.rdu.redhat.com [172.16.50.85]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j17H9dO09717; Mon, 7 Feb 2005 12:09:39 -0500 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 9AEF27D79; Mon, 7 Feb 2005 12:09:25 -0500 (EST) Message-ID: <4207A0C3.9000701@gnu.org> Date: Mon, 07 Feb 2005 21:48:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [commit] Convert VALUE_EMBEDDED_OFFSET to function Content-Type: multipart/mixed; boundary="------------000306040903090501000806" X-SW-Source: 2005-02/txt/msg00023.txt.bz2 This is a multi-part message in MIME format. --------------000306040903090501000806 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 18 committed, Andrew --------------000306040903090501000806 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 14166 * value.h (VALUE_EMBEDDED_OFFSET): Delete. (value_embedded_offset, set_value_embedded_offset): Declare. * value.c (value_embedded_offset): Define. (set_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. Index: c-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/c-valprint.c,v retrieving revision 1.30 diff -p -u -r1.30 c-valprint.c --- c-valprint.c 7 Feb 2005 00:09:53 -0000 1.30 +++ c-valprint.c 7 Feb 2005 17:03:27 -0000 @@ -598,7 +598,7 @@ c_value_print (struct value *val, struct } 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); } Index: cp-abi.h =================================================================== RCS file: /cvs/src/src/gdb/cp-abi.h,v retrieving revision 1.7 diff -p -u -r1.7 cp-abi.h --- cp-abi.h 28 Jan 2005 06:29:42 -0000 1.7 +++ cp-abi.h 7 Feb 2005 17:03:27 -0000 @@ -123,7 +123,7 @@ extern struct value *value_virtual_fn_fi 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 Index: cp-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/cp-valprint.c,v retrieving revision 1.32 diff -p -u -r1.32 cp-valprint.c --- cp-valprint.c 7 Feb 2005 00:09:53 -0000 1.32 +++ cp-valprint.c 7 Feb 2005 17:03:27 -0000 @@ -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); } Index: eval.c =================================================================== RCS file: /cvs/src/src/gdb/eval.c,v retrieving revision 1.49 diff -p -u -r1.49 eval.c --- eval.c 7 Feb 2005 00:09:53 -0000 1.49 +++ eval.c 7 Feb 2005 17:03:27 -0000 @@ -1148,7 +1148,7 @@ evaluate_subexp_standard (struct type *e 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 */ } Index: gnu-v3-abi.c =================================================================== RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v retrieving revision 1.24 diff -p -u -r1.24 gnu-v3-abi.c --- gnu-v3-abi.c 2 Feb 2005 20:31:32 -0000 1.24 +++ gnu-v3-abi.c 7 Feb 2005 17:03:27 -0000 @@ -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) Index: hpacc-abi.c =================================================================== RCS file: /cvs/src/src/gdb/hpacc-abi.c,v retrieving revision 1.11 diff -p -u -r1.11 hpacc-abi.c --- hpacc-abi.c 7 Feb 2005 00:09:53 -0000 1.11 +++ hpacc-abi.c 7 Feb 2005 17:03:27 -0000 @@ -104,7 +104,7 @@ hpacc_virtual_fn_field (struct value **a /* 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, + 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, || /* 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)))) Index: p-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/p-valprint.c,v retrieving revision 1.31 diff -p -u -r1.31 p-valprint.c --- p-valprint.c 7 Feb 2005 00:09:54 -0000 1.31 +++ p-valprint.c 7 Feb 2005 17:03:27 -0000 @@ -565,7 +565,7 @@ pascal_value_print (struct value *val, s 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); } Index: valops.c =================================================================== RCS file: /cvs/src/src/gdb/valops.c,v retrieving revision 1.146 diff -p -u -r1.146 valops.c --- valops.c 7 Feb 2005 15:04:43 -0000 1.146 +++ valops.c 7 Feb 2005 17:03:28 -0000 @@ -398,7 +398,7 @@ value_cast (struct type *type, struct va 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, struc 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, struc 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 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, c 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, s 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; } Index: value.c =================================================================== RCS file: /cvs/src/src/gdb/value.c,v retrieving revision 1.14 diff -p -u -r1.14 value.c --- value.c 7 Feb 2005 15:04:43 -0000 1.14 +++ value.c 7 Feb 2005 17:03:29 -0000 @@ -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 *v { 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 *arg 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 *arg 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) Index: value.h =================================================================== RCS file: /cvs/src/src/gdb/value.h,v retrieving revision 1.72 diff -p -u -r1.72 value.h --- value.h 7 Feb 2005 15:04:43 -0000 1.72 +++ value.h 7 Feb 2005 17:03:29 -0000 @@ -215,7 +215,8 @@ extern int value_fetch_lazy (struct valu #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. */ Index: mi/mi-main.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-main.c,v retrieving revision 1.74 diff -p -u -r1.74 mi-main.c --- mi/mi-main.c 7 Feb 2005 00:09:56 -0000 1.74 +++ mi/mi-main.c 7 Feb 2005 17:03:29 -0000 @@ -680,7 +680,7 @@ mi_cmd_data_evaluate_expression (char *c /* 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); --------------000306040903090501000806--