This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Hack value's lval, regnum, address, internalvar, and frame_idfields


Hello, this converts the remaining VALUE_ REGNUM ADDRESS INTERNALVAR and FRAME_ID maro's into functions. For reasons noted in:

http://sources.redhat.com/ml/gdb/2005-02/msg00029.html
However, for the VALUE fields that describe the actual location (i.e., PIECE) there's a problem - there are now N PIECEs. Initially I'll assume there's only one piece giving:

Old:	value->lval
Hack:	value->contents->piece[0]->lval


(the assume-one-piece methods will be DEPRECATED). Going forward the code can be updated to eliminate that assumption, instead iterating over multiple pieces.

I've called the wrapper functions deprecated_XXXX_hack (Hmm, I see one hack got duplicated) and just switched the macro's to use them. Medium term neither the macros nor the functions have a future.


committed,
Andrew
2005-02-07  Andrew Cagney  <cagney@gnu.org>

	* value.h (deprecated_value_lval_hack)
	(deprecated_value_address_hack) 
	(deprecated_value_internalvar_hack_hack) 
	(deprecated_value_regnum_hack): Declare.
	(VALUE_LVAL, VALUE_ADDRESS, VALUE_INTERNALVAR) 
	(VALUE_FRAME_ID, VALUE_REGNUM): Use.
	* value.c (deprecated_value_lval_hack)
	(deprecated_value_address_hack) 
	(deprecated_value_internalvar_hack_hack) 
	(deprecated_value_regnum_hack): Define.

Index: value.c
===================================================================
RCS file: /cvs/src/src/gdb/value.c,v
retrieving revision 1.16
diff -p -u -r1.16 value.c
--- value.c	7 Feb 2005 20:17:28 -0000	1.16
+++ value.c	7 Feb 2005 21:34:06 -0000
@@ -234,6 +234,36 @@ set_value_pointed_to_offset (struct valu
 {
   value->pointed_to_offset = val;
 }
+
+enum lval_type *
+deprecated_value_lval_hack (struct value *value)
+{
+  return &value->lval;
+}
+
+CORE_ADDR *
+deprecated_value_address_hack (struct value *value)
+{
+  return &value->location.address;
+}
+
+struct internalvar **
+deprecated_value_internalvar_hack (struct value *value)
+{
+  return &value->location.internalvar;
+}
+
+struct frame_id *
+deprecated_value_frame_id_hack (struct value *value)
+{
+  return &value->frame_id;
+}
+
+short *
+deprecated_value_regnum_hack (struct value *value)
+{
+  return &value->regnum;
+}
 
 /* Return a mark in the value chain.  All values allocated after the
    mark is obtained (except for those released) are subject to being freed
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.74
diff -p -u -r1.74 value.h
--- value.h	7 Feb 2005 20:17:28 -0000	1.74
+++ value.h	7 Feb 2005 21:34:06 -0000
@@ -208,11 +208,6 @@ extern const bfd_byte *value_contents_al
 
 extern int value_fetch_lazy (struct value *val);
 
-#define VALUE_LVAL(val) (val)->lval
-#define VALUE_ADDRESS(val) (val)->location.address
-#define VALUE_INTERNALVAR(val) (val)->location.internalvar
-#define VALUE_FRAME_ID(val) ((val)->frame_id)
-#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);
 extern int value_embedded_offset (struct value *value);
@@ -220,6 +215,20 @@ extern void set_value_embedded_offset (s
 extern int value_pointed_to_offset (struct value *value);
 extern void set_value_pointed_to_offset (struct value *value, int val);
 
+/* While the following fields are per- VALUE .CONTENT .PIECE (i.e., a
+   single value might have multiple LVALs), this hacked interface is
+   limited to just the first PIECE.  Expect further change.  */
+extern enum lval_type *deprecated_value_lval_hack (struct value *);
+#define VALUE_LVAL(val) (*deprecated_value_lval_hack (val))
+extern CORE_ADDR *deprecated_value_address_hack (struct value *);
+#define VALUE_ADDRESS(val) (*deprecated_value_address_hack (val))
+extern struct internalvar **deprecated_value_internalvar_hack (struct value *);
+#define VALUE_INTERNALVAR(val) (*deprecated_value_internalvar_hack (val))
+extern struct frame_id *deprecated_value_frame_id_hack (struct value *);
+#define VALUE_FRAME_ID(val) (*deprecated_value_frame_id_hack (val))
+extern short *deprecated_value_regnum_hack (struct value *);
+#define VALUE_REGNUM(val) (*deprecated_value_regnum_hack (val))
+
 /* Convert a REF to the object referenced.  */
 
 extern struct value *coerce_ref (struct value *value);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]