X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fada-valprint.c;h=32b85f2394623b123fc5f575d4e0319863dd0284;hb=8e069a981cbb9b33ccfbdd82ad7da5ce8b0c35b2;hp=09266ceb6beb2da1808b9b663633f050dd0cea9a;hpb=dd70cc93886d30b8fa7313122946e50e9e224072;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 09266ceb6b..32b85f2394 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -1,8 +1,7 @@ /* 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. @@ -682,13 +681,18 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr, 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 @@ -897,9 +901,18 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr, 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 = @@ -950,13 +963,13 @@ print_variant_part (struct type *type, int field_num, 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. */ @@ -990,14 +1003,14 @@ ada_value_print (struct value *val0, struct ui_file *stream, 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