aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-06-29 15:32:40 +0000
committerTom Tromey <tromey@redhat.com>2011-06-29 15:32:40 +0000
commit3b2b8feaf4aaa62c7d55ad845c3ff34165a3af22 (patch)
tree05f9c11e7c9408d89574648e7b0b2a9c0aec63a7 /gdb/f-valprint.c
parent168e6d44026869c1cd8dd66d7ef7cdeecdcff77d (diff)
downloadgdb-3b2b8feaf4aaa62c7d55ad845c3ff34165a3af22.zip
gdb-3b2b8feaf4aaa62c7d55ad845c3ff34165a3af22.tar.gz
gdb-3b2b8feaf4aaa62c7d55ad845c3ff34165a3af22.tar.bz2
gdb
PR fortran/10036: * valprint.h (generic_emit_char, generic_printstr): Declare. * valprint.c (wchar_printable, append_string_as_wide) (print_wchar): Move from c-lang.c. (generic_emit_char): New function; mostly taken from c_emit_char. (generic_printstr): New function; mostly taken from c_printstr. * f-valprint.c (f_val_print) <TYPE_CODE_ARRAY>: Handle strings represented as arrays. <TYPE_CODE_CHAR>: Treat as TYPE_CODE_INT; recognize as character type. * f-typeprint.c (f_type_print_base) <TYPE_CODE_CHAR>: Treat identically to TYPE_CODE_INT. * f-lang.c (f_get_encoding): New function. (f_emit_char): Use generic_emit_char. (f_printchar): Replace comment. (f_printstr): Use generic_printstr. * dwarf2read.c (read_base_type) <DW_ATE_unsigned>: Handle Fortran "character" types specially. <DW_ATE_signed_char, DW_ATE_unsigned_char>: Make TYPE_CODE_CHAR for Fortran. * c-lang.c (wchar_printable, append_string_as_wide, print_wchar): Move to valprint.c (c_emit_char): Call generic_emit_char. (c_printstr): Call generic_printstr. gdb/testsuite * gdb.fortran/charset.exp: New file. * gdb.fortran/charset.f90: New file.
Diffstat (limited to 'gdb/f-valprint.c')
-rw-r--r--gdb/f-valprint.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 3280ddc..66b425d 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -271,10 +271,23 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
break;
case TYPE_CODE_ARRAY:
- fprintf_filtered (stream, "(");
- f77_print_array (type, valaddr, embedded_offset,
- address, stream, recurse, original_value, options);
- fprintf_filtered (stream, ")");
+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_CHAR)
+ {
+ fprintf_filtered (stream, "(");
+ f77_print_array (type, valaddr, embedded_offset,
+ address, stream, recurse, original_value, options);
+ fprintf_filtered (stream, ")");
+ }
+ else
+ {
+ struct type *ch_type = TYPE_TARGET_TYPE (type);
+
+ f77_get_dynamic_length_of_aggregate (type);
+ LA_PRINT_STRING (stream, ch_type,
+ valaddr + embedded_offset,
+ TYPE_LENGTH (type) / TYPE_LENGTH (ch_type),
+ NULL, 0, options);
+ }
break;
case TYPE_CODE_PTR:
@@ -363,6 +376,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
break;
case TYPE_CODE_INT:
+ case TYPE_CODE_CHAR:
if (options->format || options->output_format)
{
struct value_print_options opts = *options;
@@ -379,7 +393,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
Since we don't know whether the value is really intended to
be used as an integer or a character, print the character
equivalent as well. */
- if (TYPE_LENGTH (type) == 1)
+ if (TYPE_LENGTH (type) == 1 || TYPE_CODE (type) == TYPE_CODE_CHAR)
{
LONGEST c;