/* Support for printing Ada values for GDB, the GNU debugger.
- Copyright (C) 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1997, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1986, 1988-1989, 1991-1994, 1997, 2001-2012 Free
+ Software Foundation, Inc.
This file is part of GDB.
type = ada_check_typedef (type);
if (ada_is_array_descriptor_type (type)
- || ada_is_constrained_packed_array_type (type))
+ || (ada_is_constrained_packed_array_type (type)
+ && TYPE_CODE (type) != TYPE_CODE_PTR))
{
int retn;
struct value *mark = value_mark ();
struct value *val;
val = value_from_contents_and_address (type, valaddr + offset, address);
+ /* If this is a reference, coerce it now. This helps taking care
+ of the case where ADDRESS is meaningless because original_value
+ was not an lval. */
+ val = coerce_ref (val);
if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) /* array access type. */
val = ada_coerce_to_simple_array_ptr (val);
else
if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
{
- CORE_ADDR deref_val_int
- = unpack_pointer (type, valaddr + offset_aligned);
+ CORE_ADDR deref_val_int;
+ struct value *deref_val;
+ deref_val = coerce_ref_if_computed (original_value);
+ if (deref_val)
+ {
+ common_val_print (deref_val, stream, recurse + 1, options,
+ current_language);
+ break;
+ }
+
+ deref_val_int = unpack_pointer (type, valaddr + offset_aligned);
if (deref_val_int != 0)
{
struct value *deref_val =
comma_needed, outer_type, outer_offset);
}
-int
+void
ada_value_print (struct value *val0, struct ui_file *stream,
const struct value_print_options *options)
{
struct value *val = ada_to_fixed_value (val0);
CORE_ADDR address = value_address (val);
- struct type *type = value_type (val);
+ struct type *type = ada_check_typedef (value_type (val));
struct value_print_options opts;
/* If it is a pointer, indicate what it points to. */
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") (...?)");
- return 0;
+ return;
}
opts = *options;
opts.deref_ref = 1;
- return (val_print (type, value_contents_for_printing (val),
- value_embedded_offset (val), address,
- stream, 0, val, &opts, current_language));
+ val_print (type, value_contents_for_printing (val),
+ value_embedded_offset (val), address,
+ stream, 0, val, &opts, current_language);
}
static void