fprintf_filtered (stream, "%d: ", i);
else
fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
- val_print (VALUE_TYPE (v), VALUE_CONTENTS (v), 0,
- stream, format, 2, 1, pretty);
+ val_print (VALUE_TYPE (v), VALUE_CONTENTS (v), 0, 0,
+ stream, format, 2, 1, pretty);
things_printed++;
i += reps;
}
return 0;
}
- return (val_print (type, VALUE_CONTENTS (val), address,
+ /* If it's type String, print it */
+
+ if (TYPE_CODE (type) == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (type)
+ && TYPE_NAME (TYPE_TARGET_TYPE (type))
+ && strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "java.lang.String") == 0
+ && (format == 0 || format == 's')
+ && address != 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 */
+
+ data_val = value_struct_elt (&val, NULL, "data", NULL, NULL);
+ data = value_as_pointer (data_val);
+
+ boffset_val = value_struct_elt (&val, NULL, "boffset", NULL, NULL);
+ boffset = value_as_pointer (boffset_val);
+
+ count_val = value_struct_elt (&val, NULL, "count", NULL, NULL);
+ count = value_as_pointer (count_val);
+
+ value_free_to_mark (mark); /* Release unnecessary values */
+
+ val_print_string (data + boffset, count, 2, stream);
+
+ return 0;
+ }
+
+ return (val_print (type, VALUE_CONTENTS (val), 0, address,
stream, format, 1, 0, pretty));
}
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i));
- val_print (TYPE_FIELD_TYPE(type, i), VALUE_CONTENTS (v), 0,
+ val_print (TYPE_FIELD_TYPE(type, i), VALUE_CONTENTS (v),
+ 0, 0,
stream, format, 0, recurse + 1, pretty);
}
}
if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
v = value_addr (v);
val_print (VALUE_TYPE (v),
- VALUE_CONTENTS (v), VALUE_ADDRESS (v),
+ VALUE_CONTENTS (v), 0, VALUE_ADDRESS (v),
stream, format, 0, recurse+1, pretty);
}
}
{
val_print (TYPE_FIELD_TYPE (type, i),
valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
+ 0,
address + TYPE_FIELD_BITPOS (type, i) / 8,
stream, format, 0, recurse + 1, pretty);
}
fprintf_filtered (stream, "}");
}
+/* Print data of type TYPE located at VALADDR (within GDB), which came from
+ the inferior at address ADDRESS, onto stdio stream STREAM according to
+ FORMAT (a letter or 0 for natural format). The data at VALADDR is in
+ target byte order.
+
+ If the data are a string pointer, returns the number of string characters
+ printed.
+
+ If DEREF_REF is nonzero, then dereference references, otherwise just print
+ them like pointers.
+
+ The PRETTY parameter controls prettyprinting. */
+
int
-java_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
- pretty)
+java_val_print (type, valaddr, embedded_offset, address, stream, format,
+ deref_ref, recurse, pretty)
struct type *type;
char *valaddr;
+ int embedded_offset;
CORE_ADDR address;
GDB_FILE *stream;
int format;
enum val_prettyprint pretty;
{
register unsigned int i = 0; /* Number of characters printed */
- struct type *elttype;
+ struct type *target_type;
CORE_ADDR addr;
CHECK_TYPEDEF (type);
fputs_filtered ("null", stream);
return i;
}
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
- {
- print_unpacked_pointer:
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ target_type = check_typedef (TYPE_TARGET_TYPE (type));
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
- {
- /* Try to print what function it points to. */
- print_address_demangle (addr, stream, demangle);
- /* Return value is irrelevant except for string pointers. */
- return (0);
- }
+ if (TYPE_CODE (target_type) == TYPE_CODE_FUNC)
+ {
+ /* Try to print what function it points to. */
+ print_address_demangle (addr, stream, demangle);
+ /* Return value is irrelevant except for string pointers. */
+ return (0);
+ }
- if (addressprint && format != 's')
- {
- fputs_filtered ("@", stream);
- print_longest (stream, 'x', 0, (ULONGEST) addr);
- }
- return i;
+ if (addressprint && format != 's')
+ {
+ fputs_filtered ("@", stream);
+ print_longest (stream, 'x', 0, (ULONGEST) addr);
}
+
+ return i;
case TYPE_CODE_CHAR:
format = format ? format : output_format;
if (format)
recurse, pretty);
break;
default:
- return c_val_print (type, valaddr, address, stream, format,
+ return c_val_print (type, valaddr, 0, address, stream, format,
deref_ref, recurse, pretty);
}
+ return 0;
}