/* Java language support routines for GDB, the GNU debugger.
- Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GDB.
/* Local functions */
-extern void _initialize_java_language PARAMS ((void));
+extern void _initialize_java_language (void);
-static int java_demangled_signature_length PARAMS ((char *));
-static void java_demangled_signature_copy PARAMS ((char *, char *));
+static int java_demangled_signature_length (char *);
+static void java_demangled_signature_copy (char *, char *);
-static struct symtab *get_java_class_symtab PARAMS ((void));
-static char *get_java_utf8_name PARAMS ((struct obstack * obstack, value_ptr name));
-static int java_class_is_primitive PARAMS ((value_ptr clas));
-static struct type *java_lookup_type PARAMS ((char *signature));
-static value_ptr java_value_string PARAMS ((char *ptr, int len));
+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 PARAMS ((int c, GDB_FILE * stream, int quoter));
+static void java_emit_char (int c, struct ui_file * stream, int quoter);
/* This objfile contains symtabs that have been dynamically created
to record dynamically loaded Java classes and dynamically
static struct objfile *dynamics_objfile = NULL;
-static struct type *java_link_class_type PARAMS ((struct type *, value_ptr));
+static struct type *java_link_class_type (struct type *, struct value *);
static struct objfile *
-get_dynamics_objfile ()
+get_dynamics_objfile (void)
{
if (dynamics_objfile == NULL)
{
static int class_symtab_space;
static struct symtab *
-get_java_class_symtab ()
+get_java_class_symtab (void)
{
if (class_symtab == NULL)
{
}
static void
-add_class_symtab_symbol (sym)
- struct symbol *sym;
+add_class_symtab_symbol (struct symbol *sym)
{
struct symtab *symtab = get_java_class_symtab ();
struct blockvector *bv = BLOCKVECTOR (symtab);
BLOCK_NSYMS (bl) = BLOCK_NSYMS (bl) + 1;
}
-static struct symbol *add_class_symbol PARAMS ((struct type * type, CORE_ADDR addr));
+static struct symbol *add_class_symbol (struct type *type, CORE_ADDR addr);
static struct symbol *
-add_class_symbol (type, addr)
- struct type *type;
- CORE_ADDR addr;
+add_class_symbol (struct type *type, CORE_ADDR addr)
{
struct symbol *sym;
sym = (struct symbol *)
#endif
struct type *
-java_lookup_class (name)
- char *name;
+java_lookup_class (char *name)
{
struct symbol *sym;
sym = lookup_symbol (name, expression_context_block, STRUCT_NAMESPACE,
a name given by NAME (which has type Utf8Const*). */
char *
-get_java_utf8_name (obstack, name)
- struct obstack *obstack;
- value_ptr name;
+get_java_utf8_name (struct obstack *obstack, struct value *name)
{
char *chrs;
- value_ptr temp = name;
+ struct value *temp = name;
int name_length;
CORE_ADDR data_addr;
temp = value_struct_elt (&temp, NULL, "length", NULL, "structure");
+ TYPE_LENGTH (VALUE_TYPE (temp));
chrs = obstack_alloc (obstack, name_length + 1);
chrs[name_length] = '\0';
- read_memory_section (data_addr, chrs, name_length, NULL);
+ read_memory (data_addr, chrs, name_length);
return chrs;
}
-value_ptr
-java_class_from_object (obj_val)
- value_ptr obj_val;
+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 */
- value_ptr vtable_val;
+ struct value *vtable_val;
if (TYPE_CODE (VALUE_TYPE (obj_val)) == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (obj_val))) == 0)
obj_val = value_at (get_java_object_type (),
- value_as_pointer (obj_val), NULL);
+ value_as_address (obj_val), NULL);
vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
/* Check if CLASS_IS_PRIMITIVE(value of clas): */
static int
-java_class_is_primitive (clas)
- value_ptr clas;
+java_class_is_primitive (struct value *clas)
{
- value_ptr vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
- CORE_ADDR i = value_as_pointer (vtable);
+ struct value *vtable = value_struct_elt (&clas, NULL, "vtable", NULL, "struct");
+ CORE_ADDR i = value_as_address (vtable);
return (int) (i & 0x7fffffff) == (int) 0x7fffffff;
}
/* Read a GCJ Class object, and generated a gdb (TYPE_CODE_STRUCT) type. */
struct type *
-type_from_class (clas)
- value_ptr clas;
+type_from_class (struct value *clas)
{
struct type *type;
char *name;
- value_ptr temp;
+ struct value *temp;
struct objfile *objfile;
- value_ptr utf8_name;
+ struct value *utf8_name;
char *nptr;
CORE_ADDR addr;
struct block *bl;
objfile = get_dynamics_objfile ();
if (java_class_is_primitive (clas))
{
- value_ptr sig;
+ struct value *sig;
temp = clas;
sig = value_struct_elt (&temp, NULL, "method_count", NULL, "structure");
return java_primitive_type (value_as_long (sig));
/* Fill in class TYPE with data from the CLAS value. */
struct type *
-java_link_class_type (type, clas)
- struct type *type;
- value_ptr clas;
+java_link_class_type (struct type *type, struct value *clas)
{
- value_ptr temp;
+ 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;
- value_ptr fields, field, method, methods;
+ struct value *fields;
+ struct value *methods;
+ struct value *method = NULL;
+ struct value *field = NULL;
int i, j;
struct objfile *objfile = get_dynamics_objfile ();
struct type *tsuper;
static struct type *java_object_type;
struct type *
-get_java_object_type ()
+get_java_object_type (void)
{
if (java_object_type == NULL)
{
}
int
-get_java_object_header_size ()
+get_java_object_header_size (void)
{
struct type *objtype = get_java_object_type ();
if (objtype == NULL)
}
int
-is_object_type (type)
- struct type *type;
+is_object_type (struct type *type)
{
CHECK_TYPEDEF (type);
if (TYPE_CODE (type) == TYPE_CODE_PTR)
}
struct type *
-java_primitive_type (signature)
- int signature;
+java_primitive_type (int signature)
{
switch (signature)
{
return that type. Otherwise, return NULL. */
struct type *
-java_primitive_type_from_name (name, namelen)
- char *name;
- int namelen;
+java_primitive_type_from_name (char *name, int namelen)
{
switch (name[0])
{
signature string SIGNATURE. */
static int
-java_demangled_signature_length (signature)
- char *signature;
+java_demangled_signature_length (char *signature)
{
int array = 0;
for (; *signature == '['; signature++)
/* Demangle the Java type signature SIGNATURE, leaving the result in RESULT. */
static void
-java_demangled_signature_copy (result, signature)
- char *result;
- char *signature;
+java_demangled_signature_copy (char *result, char *signature)
{
int array = 0;
char *ptr;
as a freshly allocated copy. */
char *
-java_demangle_type_signature (signature)
- char *signature;
+java_demangle_type_signature (char *signature)
{
int length = java_demangled_signature_length (signature);
char *result = xmalloc (length + 1);
}
struct type *
-java_lookup_type (signature)
- char *signature;
+java_lookup_type (char *signature)
{
switch (signature[0])
{
If DIMS == 0, TYPE is returned. */
struct type *
-java_array_type (type, dims)
- struct type *type;
- int dims;
+java_array_type (struct type *type, int dims)
{
struct type *range_type;
/* Create a Java string in the inferior from a (Utf8) literal. */
-static value_ptr
-java_value_string (ptr, len)
- char *ptr;
- int len;
+static struct value *
+java_value_string (char *ptr, int len)
{
error ("not implemented - java_value_string"); /* FIXME */
}
characters and strings is language specific. */
static void
-java_emit_char (c, stream, quoter)
- int c;
- GDB_FILE *stream;
- int quoter;
+java_emit_char (int c, struct ui_file *stream, int quoter)
{
switch (c)
{
}
}
-static value_ptr
-evaluate_subexp_java (expect_type, exp, pos, noside)
- struct type *expect_type;
- register struct expression *exp;
- register int *pos;
- enum noside noside;
+static struct value *
+evaluate_subexp_java (struct type *expect_type, register struct expression *exp,
+ register int *pos, enum noside noside)
{
int pc = *pos;
int i;
char *name;
enum exp_opcode op = exp->elts[*pos].opcode;
- value_ptr arg1, arg2;
+ struct value *arg1;
+ struct value *arg2;
struct type *type;
switch (op)
{
struct type *el_type;
char buf4[4];
- value_ptr clas = java_class_from_object (arg1);
- value_ptr temp = clas;
+ 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");
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (el_type, VALUE_LVAL (arg1));
- address = value_as_pointer (arg1);
+ address = value_as_address (arg1);
address += JAVA_OBJECT_SIZE;
read_memory (address, buf4, 4);
length = (long) extract_signed_integer (buf4, 4);
}
static struct type *
-java_create_fundamental_type (objfile, typeid)
- struct objfile *objfile;
- int typeid;
+java_create_fundamental_type (struct objfile *objfile, int typeid)
{
switch (typeid)
{
c_builtin_types,
range_check_off,
type_check_off,
+ case_sensitive_on,
java_parse,
java_error,
evaluate_subexp_java,
};
void
-_initialize_java_language ()
+_initialize_java_language (void)
{
java_int_type = init_type (TYPE_CODE_INT, 4, 0, "int", NULL);
We should use make_run_cleanup to have this be called.
But will that mess up values in value histry? FIXME */
-extern void java_rerun_cleanup PARAMS ((void));
+extern void java_rerun_cleanup (void);
void
-java_rerun_cleanup ()
+java_rerun_cleanup (void)
{
if (class_symtab != NULL)
{