[patch] s/value_ptr/struct value */ for *jv*.[hc]
Andrew Cagney
ac131313@localhost.cygnus.com
Sat Oct 20 18:57:00 GMT 2001
FYI, another batch.
enjoy,
Andrew
2001-10-20 Andrew Cagney <ac131313@redhat.com>
* jv-lang.h: Add #ifndef JV_LANG_H wrapper.
(struct value): Add opaque declaration. Replace value_ptr with
``struct value *''.
* jv-valprint.c, jv-lang.c: Replace value_ptr with equivalent
struct.
Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.8
diff -p -r1.8 jv-lang.c
*** jv-lang.c 2001/10/16 01:58:07 1.8
--- jv-lang.c 2001/10/21 01:53:45
*************** static int java_demangled_signature_leng
*** 53,62 ****
static void java_demangled_signature_copy (char *, char *);
static struct symtab *get_java_class_symtab (void);
! static char *get_java_utf8_name (struct obstack *obstack, value_ptr name);
! static int java_class_is_primitive (value_ptr clas);
static struct type *java_lookup_type (char *signature);
! static value_ptr java_value_string (char *ptr, int len);
static void java_emit_char (int c, struct ui_file * stream, int quoter);
--- 53,62 ----
static void java_demangled_signature_copy (char *, char *);
static struct symtab *get_java_class_symtab (void);
! static char *get_java_utf8_name (struct obstack *obstack, struct value *name);
! static int java_class_is_primitive (struct value *clas);
static struct type *java_lookup_type (char *signature);
! static struct value *java_value_string (char *ptr, int len);
static void java_emit_char (int c, struct ui_file * stream, int quoter);
*************** static void java_emit_char (int c, struc
*** 66,72 ****
static struct objfile *dynamics_objfile = NULL;
! static struct type *java_link_class_type (struct type *, value_ptr);
static struct objfile *
get_dynamics_objfile (void)
--- 66,72 ----
static struct objfile *dynamics_objfile = NULL;
! static struct type *java_link_class_type (struct type *, struct value *);
static struct objfile *
get_dynamics_objfile (void)
*************** java_lookup_class (char *name)
*** 206,215 ****
a name given by NAME (which has type Utf8Const*). */
char *
! get_java_utf8_name (struct obstack *obstack, value_ptr name)
{
char *chrs;
! value_ptr temp = name;
int name_length;
CORE_ADDR data_addr;
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
--- 206,215 ----
a name given by NAME (which has type Utf8Const*). */
char *
! get_java_utf8_name (struct obstack *obstack, struct value *name)
{
char *chrs;
! struct value *temp = name;
int name_length;
CORE_ADDR data_addr;
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
*************** get_java_utf8_name (struct obstack *obst
*** 222,233 ****
return chrs;
}
! value_ptr
! java_class_from_object (value_ptr obj_val)
{
/* This is all rather inefficient, since the offsets of vtable and
class are fixed. FIXME */
! value_ptr vtable_val;
if (TYPE_CODE (VALUE_TYPE (obj_val)) == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (obj_val))) == 0)
--- 222,233 ----
return chrs;
}
! struct value *
! java_class_from_object (struct value *obj_val)
{
/* This is all rather inefficient, since the offsets of vtable and
class are fixed. FIXME */
! struct value *vtable_val;
if (TYPE_CODE (VALUE_TYPE (obj_val)) == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (obj_val))) == 0)
*************** java_class_from_object (value_ptr obj_va
*** 240,248 ****
/* Check if CLASS_IS_PRIMITIVE(value of clas): */
static int
! java_class_is_primitive (value_ptr clas)
{
! value_ptr vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
CORE_ADDR i = value_as_address (vtable);
return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
}
--- 240,248 ----
/* Check if CLASS_IS_PRIMITIVE(value of clas): */
static int
! java_class_is_primitive (struct value *clas)
{
! struct value *vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
CORE_ADDR i = value_as_address (vtable);
return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
}
*************** java_class_is_primitive (value_ptr clas)
*** 250,262 ****
/* Read a GCJ Class object, and generated a gdb (TYPE_CODE_STRUCT) type. */
struct type *
! type_from_class (value_ptr clas)
{
struct type *type;
char *name;
! value_ptr temp;
struct objfile *objfile;
! value_ptr utf8_name;
char *nptr;
CORE_ADDR addr;
struct block *bl;
--- 250,262 ----
/* Read a GCJ Class object, and generated a gdb (TYPE_CODE_STRUCT) type. */
struct type *
! type_from_class (struct value *clas)
{
struct type *type;
char *name;
! struct value *temp;
struct objfile *objfile;
! struct value *utf8_name;
char *nptr;
CORE_ADDR addr;
struct block *bl;
*************** type_from_class (value_ptr clas)
*** 286,292 ****
objfile = get_dynamics_objfile ();
if (java_class_is_primitive (clas))
{
! value_ptr sig;
temp = clas;
sig = value_struct_elt (&temp, NULL, "method_count", NULL, "structure");
return java_primitive_type (value_as_long (sig));
--- 286,292 ----
objfile = get_dynamics_objfile ();
if (java_class_is_primitive (clas))
{
! struct value *sig;
temp = clas;
sig = value_struct_elt (&temp, NULL, "method_count", NULL, "structure");
return java_primitive_type (value_as_long (sig));
*************** type_from_class (value_ptr clas)
*** 337,352 ****
/* Fill in class TYPE with data from the CLAS value. */
struct type *
! java_link_class_type (struct type *type, value_ptr clas)
{
! value_ptr temp;
char *unqualified_name;
char *name = TYPE_TAG_NAME (type);
int ninterfaces, nfields, nmethods;
int type_is_object = 0;
struct fn_field *fn_fields;
struct fn_fieldlist *fn_fieldlists;
! value_ptr fields, methods;
struct value *method = NULL;
struct value *field = NULL;
int i, j;
--- 337,353 ----
/* Fill in class TYPE with data from the CLAS value. */
struct type *
! java_link_class_type (struct type *type, struct value *clas)
{
! struct value *temp;
char *unqualified_name;
char *name = TYPE_TAG_NAME (type);
int ninterfaces, nfields, nmethods;
int type_is_object = 0;
struct fn_field *fn_fields;
struct fn_fieldlist *fn_fieldlists;
! struct value *fields;
! struct value *methods;
struct value *method = NULL;
struct value *field = NULL;
int i, j;
*************** java_array_type (struct type *type, int
*** 802,808 ****
/* Create a Java string in the inferior from a (Utf8) literal. */
! static value_ptr
java_value_string (char *ptr, int len)
{
error ("not implemented - java_value_string"); /* FIXME */
--- 803,809 ----
/* Create a Java string in the inferior from a (Utf8) literal. */
! static struct value *
java_value_string (char *ptr, int len)
{
error ("not implemented - java_value_string"); /* FIXME */
*************** java_emit_char (int c, struct ui_file *s
*** 845,851 ****
}
}
! static value_ptr
evaluate_subexp_java (struct type *expect_type, register struct expression *exp,
register int *pos, enum noside noside)
{
--- 846,852 ----
}
}
! static struct value *
evaluate_subexp_java (struct type *expect_type, register struct expression *exp,
register int *pos, enum noside noside)
{
*************** evaluate_subexp_java (struct type *expec
*** 853,859 ****
int i;
char *name;
enum exp_opcode op = exp->elts[*pos].opcode;
! value_ptr arg1, arg2;
struct type *type;
switch (op)
{
--- 854,861 ----
int i;
char *name;
enum exp_opcode op = exp->elts[*pos].opcode;
! struct value *arg1;
! struct value *arg2;
struct type *type;
switch (op)
{
*************** evaluate_subexp_java (struct type *expec
*** 899,906 ****
struct type *el_type;
char buf4[4];
! value_ptr clas = java_class_from_object (arg1);
! value_ptr temp = clas;
/* Get CLASS_ELEMENT_TYPE of the array type. */
temp = value_struct_elt (&temp, NULL, "methods",
NULL, "structure");
--- 901,908 ----
struct type *el_type;
char buf4[4];
! struct value *clas = java_class_from_object (arg1);
! struct value *temp = clas;
/* Get CLASS_ELEMENT_TYPE of the array type. */
temp = value_struct_elt (&temp, NULL, "methods",
NULL, "structure");
Index: jv-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.h,v
retrieving revision 1.3
diff -p -r1.3 jv-lang.h
*** jv-lang.h 2001/03/06 08:21:09 1.3
--- jv-lang.h 2001/10/21 01:53:45
***************
*** 18,23 ****
--- 18,28 ----
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+ #ifndef JV_LANG_H
+ #define JV_LANG_H
+
+ struct value;
+
extern int java_parse (void); /* Defined in jv-exp.y */
extern void java_error (char *); /* Defined in jv-exp.y */
*************** extern int java_val_print (struct type *
*** 42,48 ****
extern int java_value_print (struct value *, struct ui_file *, int,
enum val_prettyprint);
! extern value_ptr java_class_from_object (value_ptr);
extern struct type *type_from_class (struct value *);
--- 47,53 ----
extern int java_value_print (struct value *, struct ui_file *, int,
enum val_prettyprint);
! extern struct value *java_class_from_object (struct value *);
extern struct type *type_from_class (struct value *);
*************** extern void java_print_type (struct type
*** 64,66 ****
--- 69,73 ----
int);
extern char *java_demangle_type_signature (char *);
+
+ #endif
Index: jv-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-valprint.c,v
retrieving revision 1.8
diff -p -r1.8 jv-valprint.c
*** jv-valprint.c 2001/10/16 01:58:07 1.8
--- jv-valprint.c 2001/10/21 01:53:46
*************** static void java_print_value_fields (str
*** 41,47 ****
int
! java_value_print (value_ptr val, struct ui_file *stream, int format,
enum val_prettyprint pretty)
{
struct type *type;
--- 41,47 ----
int
! java_value_print (struct value *val, struct ui_file *stream, int format,
enum val_prettyprint pretty)
{
struct type *type;
*************** java_value_print (value_ptr val, struct
*** 137,144 ****
}
else
{
! value_ptr v = allocate_value (el_type);
! value_ptr next_v = allocate_value (el_type);
VALUE_ADDRESS (v) = address + JAVA_OBJECT_SIZE + 4;
VALUE_ADDRESS (next_v) = VALUE_ADDRESS (v);
--- 137,144 ----
}
else
{
! struct value *v = allocate_value (el_type);
! struct value *next_v = allocate_value (el_type);
VALUE_ADDRESS (v) = address + JAVA_OBJECT_SIZE + 4;
VALUE_ADDRESS (next_v) = VALUE_ADDRESS (v);
*************** java_value_print (value_ptr val, struct
*** 150,156 ****
if (i > 0)
{
! value_ptr tmp;
tmp = next_v;
next_v = v;
--- 150,156 ----
if (i > 0)
{
! struct value *tmp;
tmp = next_v;
next_v = v;
*************** java_value_print (value_ptr val, struct
*** 204,216 ****
&& address != 0
&& value_as_address (val) != 0)
{
! value_ptr data_val;
CORE_ADDR data;
! value_ptr boffset_val;
unsigned long boffset;
! value_ptr count_val;
unsigned long count;
! value_ptr mark;
mark = value_mark (); /* Remember start of new values */
--- 204,216 ----
&& address != 0
&& value_as_address (val) != 0)
{
! struct value *data_val;
CORE_ADDR data;
! struct value *boffset_val;
unsigned long boffset;
! struct value *count_val;
unsigned long count;
! struct value *mark;
mark = value_mark (); /* Remember start of new values */
*************** java_print_value_fields (struct type *ty
*** 370,376 ****
if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
{
! value_ptr v;
/* Bitfields require special handling, especially due to byte
order problems. */
--- 370,376 ----
if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
{
! struct value *v;
/* Bitfields require special handling, especially due to byte
order problems. */
*************** java_print_value_fields (struct type *ty
*** 395,401 ****
}
else if (TYPE_FIELD_STATIC (type, i))
{
! value_ptr v = value_static_field (type, i);
if (v == NULL)
fputs_filtered ("<optimized out>", stream);
else
--- 395,401 ----
}
else if (TYPE_FIELD_STATIC (type, i))
{
! struct value *v = value_static_field (type, i);
if (v == NULL)
fputs_filtered ("<optimized out>", stream);
else
More information about the Gdb-patches
mailing list