/* Support for printing Fortran values for GDB, the GNU debugger.
- Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1993-1996, 1998-2000, 2003, 2005-2012 Free Software
+ Foundation, Inc.
Contributed by Motorola. Adapted from the C definitions by Farooq Butt
(fmbutt@engage.sps.mot.com), additionally worked over by Stan Shebs.
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
-static void list_all_visible_commons (char *);
+static void list_all_visible_commons (const char *);
static void f77_create_arrayprint_offset_tbl (struct type *,
struct ui_file *);
static void f77_get_dynamic_length_of_aggregate (struct type *);
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:
{
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
{
- struct value *deref_val =
- value_at
- (TYPE_TARGET_TYPE (type),
- unpack_pointer (type, valaddr + embedded_offset));
+ struct value *deref_val;
+
+ deref_val = coerce_ref_if_computed (original_value);
+ if (deref_val != NULL)
+ {
+ /* More complicated computed references are not supported. */
+ gdb_assert (embedded_offset == 0);
+ }
+ else
+ deref_val = value_at (TYPE_TARGET_TYPE (type),
+ unpack_pointer (type,
+ (valaddr
+ + embedded_offset)));
common_val_print (deref_val, stream, recurse,
options, current_language);
break;
case TYPE_CODE_INT:
+ case TYPE_CODE_CHAR:
if (options->format || options->output_format)
{
struct value_print_options opts = *options;
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;
}
static void
-list_all_visible_commons (char *funname)
+list_all_visible_commons (const char *funname)
{
SAVED_F77_COMMON_PTR tmp;
SAVED_F77_COMMON_PTR the_common;
COMMON_ENTRY_PTR entry;
struct frame_info *fi;
- char *funname = 0;
+ const char *funname = 0;
struct symbol *func;
/* We have been told to display the contents of F77 COMMON