* jv-lang.h (JAVA_OBJECT_SIZE): Remove.
(get_java_object_header_size): Add GDBARCH parameter. * jv-lang.c (get_java_object_header_size): Add GDBARCH parameter. Use it instead of current_gdbarch. (evaluate_subexp_java): Replace JAVA_OBJECT_SIZE with call to get_java_object_header_size. * jv-valprint.c (java_value_print): Likewise.
This commit is contained in:
parent
3d857b98f5
commit
45d5d5ca5d
|
@ -1,3 +1,13 @@
|
||||||
|
2009-06-23 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
|
* jv-lang.h (JAVA_OBJECT_SIZE): Remove.
|
||||||
|
(get_java_object_header_size): Add GDBARCH parameter.
|
||||||
|
* jv-lang.c (get_java_object_header_size): Add GDBARCH parameter.
|
||||||
|
Use it instead of current_gdbarch.
|
||||||
|
(evaluate_subexp_java): Replace JAVA_OBJECT_SIZE with call to
|
||||||
|
get_java_object_header_size.
|
||||||
|
* jv-valprint.c (java_value_print): Likewise.
|
||||||
|
|
||||||
2009-06-23 Sami Wagiaalla <swagiaal@redhat.com>
|
2009-06-23 Sami Wagiaalla <swagiaal@redhat.com>
|
||||||
|
|
||||||
* dwarf2read.c (process_die): Handle import statements
|
* dwarf2read.c (process_die): Handle import statements
|
||||||
|
|
|
@ -589,11 +589,11 @@ get_java_object_type (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
get_java_object_header_size (void)
|
get_java_object_header_size (struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
struct type *objtype = get_java_object_type ();
|
struct type *objtype = get_java_object_type ();
|
||||||
if (objtype == NULL)
|
if (objtype == NULL)
|
||||||
return (2 * gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
|
return (2 * gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
|
||||||
else
|
else
|
||||||
return TYPE_LENGTH (objtype);
|
return TYPE_LENGTH (objtype);
|
||||||
}
|
}
|
||||||
|
@ -900,7 +900,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp,
|
||||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
return value_zero (el_type, VALUE_LVAL (arg1));
|
return value_zero (el_type, VALUE_LVAL (arg1));
|
||||||
address = value_as_address (arg1);
|
address = value_as_address (arg1);
|
||||||
address += JAVA_OBJECT_SIZE;
|
address += get_java_object_header_size (exp->gdbarch);
|
||||||
read_memory (address, buf4, 4);
|
read_memory (address, buf4, 4);
|
||||||
length = (long) extract_signed_integer (buf4, 4);
|
length = (long) extract_signed_integer (buf4, 4);
|
||||||
index = (long) value_as_long (arg2);
|
index = (long) value_as_long (arg2);
|
||||||
|
|
|
@ -27,9 +27,6 @@ extern int java_parse (void); /* Defined in jv-exp.y */
|
||||||
|
|
||||||
extern void java_error (char *); /* Defined in jv-exp.y */
|
extern void java_error (char *); /* Defined in jv-exp.y */
|
||||||
|
|
||||||
/* sizeof (struct Object) */
|
|
||||||
#define JAVA_OBJECT_SIZE (get_java_object_header_size ())
|
|
||||||
|
|
||||||
extern struct type *java_int_type;
|
extern struct type *java_int_type;
|
||||||
extern struct type *java_byte_type;
|
extern struct type *java_byte_type;
|
||||||
extern struct type *java_short_type;
|
extern struct type *java_short_type;
|
||||||
|
@ -58,7 +55,7 @@ extern struct type *java_primitive_type_from_name (char *, int);
|
||||||
extern struct type *java_array_type (struct type *, int);
|
extern struct type *java_array_type (struct type *, int);
|
||||||
|
|
||||||
extern struct type *get_java_object_type (void);
|
extern struct type *get_java_object_type (void);
|
||||||
extern int get_java_object_header_size (void);
|
extern int get_java_object_header_size (struct gdbarch *);
|
||||||
|
|
||||||
extern struct type *java_lookup_class (char *);
|
extern struct type *java_lookup_class (char *);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ int
|
||||||
java_value_print (struct value *val, struct ui_file *stream,
|
java_value_print (struct value *val, struct ui_file *stream,
|
||||||
const struct value_print_options *options)
|
const struct value_print_options *options)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *gdbarch = current_gdbarch;
|
||||||
struct type *type;
|
struct type *type;
|
||||||
CORE_ADDR address;
|
CORE_ADDR address;
|
||||||
int i;
|
int i;
|
||||||
|
@ -76,9 +77,8 @@ java_value_print (struct value *val, struct ui_file *stream,
|
||||||
unsigned int things_printed = 0;
|
unsigned int things_printed = 0;
|
||||||
int reps;
|
int reps;
|
||||||
struct type *el_type = java_primitive_type_from_name (name, i - 2);
|
struct type *el_type = java_primitive_type_from_name (name, i - 2);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
read_memory (address + JAVA_OBJECT_SIZE, buf4, 4);
|
read_memory (address + get_java_object_header_size (gdbarch), buf4, 4);
|
||||||
|
|
||||||
length = (long) extract_signed_integer (buf4, 4);
|
length = (long) extract_signed_integer (buf4, 4);
|
||||||
fprintf_filtered (stream, "{length: %ld", length);
|
fprintf_filtered (stream, "{length: %ld", length);
|
||||||
|
@ -88,13 +88,14 @@ java_value_print (struct value *val, struct ui_file *stream,
|
||||||
CORE_ADDR element;
|
CORE_ADDR element;
|
||||||
CORE_ADDR next_element = -1; /* dummy initial value */
|
CORE_ADDR next_element = -1; /* dummy initial value */
|
||||||
|
|
||||||
address += JAVA_OBJECT_SIZE + 4; /* Skip object header and length. */
|
/* Skip object header and length. */
|
||||||
|
address += get_java_object_header_size (gdbarch) + 4;
|
||||||
|
|
||||||
while (i < length && things_printed < options->print_max)
|
while (i < length && things_printed < options->print_max)
|
||||||
{
|
{
|
||||||
gdb_byte *buf;
|
gdb_byte *buf;
|
||||||
|
|
||||||
buf = alloca (gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT);
|
buf = alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT);
|
||||||
fputs_filtered (", ", stream);
|
fputs_filtered (", ", stream);
|
||||||
wrap_here (n_spaces (2));
|
wrap_here (n_spaces (2));
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ java_value_print (struct value *val, struct ui_file *stream,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
read_memory (address, buf, sizeof (buf));
|
read_memory (address, buf, sizeof (buf));
|
||||||
address += gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT;
|
address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT;
|
||||||
/* FIXME: cagney/2003-05-24: Bogus or what. It
|
/* FIXME: cagney/2003-05-24: Bogus or what. It
|
||||||
pulls a host sized pointer out of the target and
|
pulls a host sized pointer out of the target and
|
||||||
then extracts that as an address (while assuming
|
then extracts that as an address (while assuming
|
||||||
|
@ -114,7 +115,7 @@ java_value_print (struct value *val, struct ui_file *stream,
|
||||||
for (reps = 1; i + reps < length; reps++)
|
for (reps = 1; i + reps < length; reps++)
|
||||||
{
|
{
|
||||||
read_memory (address, buf, sizeof (buf));
|
read_memory (address, buf, sizeof (buf));
|
||||||
address += gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT;
|
address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT;
|
||||||
/* FIXME: cagney/2003-05-24: Bogus or what. It
|
/* FIXME: cagney/2003-05-24: Bogus or what. It
|
||||||
pulls a host sized pointer out of the target and
|
pulls a host sized pointer out of the target and
|
||||||
then extracts that as an address (while assuming
|
then extracts that as an address (while assuming
|
||||||
|
@ -143,7 +144,8 @@ java_value_print (struct value *val, struct ui_file *stream,
|
||||||
struct value *v = allocate_value (el_type);
|
struct value *v = allocate_value (el_type);
|
||||||
struct value *next_v = allocate_value (el_type);
|
struct value *next_v = allocate_value (el_type);
|
||||||
|
|
||||||
set_value_address (v, address + JAVA_OBJECT_SIZE + 4);
|
set_value_address (v, (address
|
||||||
|
+ get_java_object_header_size (gdbarch) + 4));
|
||||||
set_value_address (next_v, value_raw_address (v));
|
set_value_address (next_v, value_raw_address (v));
|
||||||
|
|
||||||
while (i < length && things_printed < options->print_max)
|
while (i < length && things_printed < options->print_max)
|
||||||
|
|
Loading…
Reference in New Issue