aboutsummaryrefslogtreecommitdiff
path: root/gdb/jv-valprint.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1998-10-05 19:42:04 +0000
committerStu Grossman <grossman@cygnus>1998-10-05 19:42:04 +0000
commit242c0d81808102504721ac1289dccec5dce660f9 (patch)
treea0d74af308640017ea9e48e4a98be116f50bac55 /gdb/jv-valprint.c
parentecd41d25b901d3fdee37e8215c288892b4c8c3d5 (diff)
downloadgdb-242c0d81808102504721ac1289dccec5dce660f9.zip
gdb-242c0d81808102504721ac1289dccec5dce660f9.tar.gz
gdb-242c0d81808102504721ac1289dccec5dce660f9.tar.bz2
* c-lang.c (emit_char c_printchar c_printstr), c-lang.h (c_printstr)
ch-lang.c (chill_printstr chill_printchar) c-valprint.c (c_val_print) ch-valprint.c (chill_val_print) expprint.c (print_subexp) f-lang.c (f_printstr f_printchar emit_char) f-valprint.c (f_val_print) jv-lang.c (java_printchar java_emit_char) jv-valprint.c (java_value_print java_val_print) language.c (unk_lang_printchar unk_lang_printstr unk_lang_emit_char) language.h (struct language_defn LA_PRINT_STRING LA_EMIT_CHAR) m2-lang.c (m2_printstr m2_printchar emit_char) printcmd.c (print_formatted) scm-lang.c (scm_printstr) valprint.c (val_print_string) value.h (val_print_string): Add emit_char routines to language_desc struct to allow finer control over language specific character output issues. Add character width arg to printstr routines to allow handling of wchar_t/Unicode strings. Fix c_printstr to handle wide characters. Supply width argument to LA_PRINT_STRING and val_print_string. * jv-lang.c (java_object_type dynamics_objfile java_link_class_type get_dynamics_objfile get_java_object_type) jv-lang.h (get_java_object_type): Make lots of things static. * expprint.c (dump_prefix_expression dump_subexp): Move opcode name printing to common routine (op_name). * (dump_subexp): Add support for OP_SCOPE.
Diffstat (limited to 'gdb/jv-valprint.c')
-rw-r--r--gdb/jv-valprint.c83
1 files changed, 64 insertions, 19 deletions
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index d46c4b8..3833984 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -149,6 +149,41 @@ java_value_print (val, stream, format, pretty)
return 0;
}
+ /* 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), address,
stream, format, 1, 0, pretty));
}
@@ -353,9 +388,22 @@ java_print_value_fields (type, valaddr, address, stream,
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)
+ pretty)
struct type *type;
char *valaddr;
CORE_ADDR address;
@@ -366,7 +414,7 @@ java_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
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);
@@ -395,26 +443,23 @@ java_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
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)