/* Support for printing Ada values for GDB, the GNU debugger.
- Copyright (C) 1986-2014 Free Software Foundation, Inc.
+ Copyright (C) 1986-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "ada-lang.h"
#include "c-lang.h"
#include "infcall.h"
-#include "exceptions.h"
#include "objfiles.h"
static int print_field_values (struct type *, const gdb_byte *,
unsigned int things_printed = 0;
unsigned len;
struct type *elttype, *index_type;
- unsigned eltlen;
unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0);
struct value *mark = value_mark ();
LONGEST low = 0;
elttype = TYPE_TARGET_TYPE (type);
- eltlen = TYPE_LENGTH (check_typedef (elttype));
index_type = TYPE_INDEX_TYPE (type);
{
(i * bitsize) / HOST_CHAR_BIT,
(i * bitsize) % HOST_CHAR_BIT,
bitsize, elttype);
+ if (TYPE_LENGTH (check_typedef (value_type (v0)))
+ != TYPE_LENGTH (check_typedef (value_type (v1))))
+ break;
if (!value_contents_eq (v0, value_embedded_offset (v0),
v1, value_embedded_offset (v1),
- eltlen))
+ TYPE_LENGTH (check_typedef (value_type (v0)))))
break;
}
if (ada_is_tagged_type (value_type (deref_val), 1))
deref_val = ada_tag_value_at_base_address (deref_val);
+ /* Make sure that the object does not have an unreasonable size
+ before trying to print it. This can happen for instance with
+ references to dynamic objects whose contents is uninitialized
+ (Eg: an array whose bounds are not set yet). */
+ ada_ensure_varsize_limit (value_type (deref_val));
+
val_print (value_type (deref_val),
value_contents_for_printing (deref_val),
value_embedded_offset (deref_val),
offset_aligned = offset + ada_aligned_value_addr (type, valaddr) - valaddr;
type = printable_val_type (type, valaddr + offset_aligned);
+ type = resolve_dynamic_type (type, valaddr + offset_aligned,
+ address + offset_aligned);
switch (TYPE_CODE (type))
{
const struct value *val,
const struct value_print_options *options)
{
- volatile struct gdb_exception except;
/* XXX: this catches QUIT/ctrl-c as well. Isn't that busted? */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ada_val_print_1 (type, valaddr, embedded_offset, address,
stream, recurse, val, options,
current_language);
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
}
void