/* Support for printing C++ values for GDB, the GNU debugger.
- Copyright (C) 1986-2015 Free Software Foundation, Inc.
+ Copyright (C) 1986-2016 Free Software Foundation, Inc.
This file is part of GDB.
const struct value_print_options *);
static void cp_print_value (struct type *, struct type *,
- const gdb_byte *, int,
+ const gdb_byte *, LONGEST,
CORE_ADDR, struct ui_file *,
int, const struct value *,
const struct value_print_options *,
/* GCC versions after 2.4.5 use this. */
-const char vtbl_ptr_name[] = "__vtbl_ptr_type";
+EXPORTED_CONST char vtbl_ptr_name[] = "__vtbl_ptr_type";
/* Return truth value for assertion that TYPE is of the type
"pointer to virtual function". */
int
cp_is_vtbl_ptr_type (struct type *type)
{
- const char *typename = type_name_no_tag (type);
+ const char *type_name = type_name_no_tag (type);
- return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
+ return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
}
/* Return truth value for the assertion that TYPE is of the type
void
cp_print_value_fields (struct type *type, struct type *real_type,
- const gdb_byte *valaddr, int offset,
+ const gdb_byte *valaddr, LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse, const struct value *val,
const struct value_print_options *options,
int fields_seen = 0;
static int last_set_recurse = -1;
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
if (recurse == 0)
{
}
else if (field_is_static (&TYPE_FIELD (type, i)))
{
- volatile struct gdb_exception ex;
struct value *v = NULL;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
v = value_static_field (type, i);
}
- if (ex.reason < 0)
- fprintf_filtered (stream,
- _("<error reading variable: %s>"),
- ex.message);
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ fprintf_filtered (stream,
+ _("<error reading variable: %s>"),
+ ex.message);
+ }
+ END_CATCH
+
cp_print_static_field (TYPE_FIELD_TYPE (type, i),
v, stream, recurse + 1,
options);
void
cp_print_value_fields_rtti (struct type *type,
- const gdb_byte *valaddr, int offset,
+ const gdb_byte *valaddr, LONGEST offset,
CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
{
struct value *value;
- int full, top, using_enc;
+ int full, using_enc;
+ LONGEST top;
/* Ugh, we have to convert back to a value here. */
value = value_from_contents_and_address (type, valaddr + offset,
static void
cp_print_value (struct type *type, struct type *real_type,
- const gdb_byte *valaddr, int offset,
+ const gdb_byte *valaddr, LONGEST offset,
CORE_ADDR address, struct ui_file *stream,
int recurse, const struct value *val,
const struct value_print_options *options,
= (struct type **) obstack_next_free (&dont_print_vb_obstack);
struct obstack tmp_obstack = dont_print_vb_obstack;
int i, n_baseclasses = TYPE_N_BASECLASSES (type);
- int thisoffset;
+ LONGEST thisoffset;
struct type *thistype;
if (dont_print_vb == 0)
for (i = 0; i < n_baseclasses; i++)
{
- int boffset = 0;
- int skip;
+ LONGEST boffset = 0;
+ int skip = 0;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
const char *basename = TYPE_NAME (baseclass);
const gdb_byte *base_valaddr = NULL;
const struct value *base_val = NULL;
- volatile struct gdb_exception ex;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
thisoffset = offset;
thistype = real_type;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
boffset = baseclass_offset (type, i, valaddr, offset, address, val);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
- skip = -1;
- else if (ex.reason < 0)
- skip = 1;
- else
- {
- skip = 0;
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ if (ex.error == NOT_AVAILABLE_ERROR)
+ skip = -1;
+ else
+ skip = 1;
+ }
+ END_CATCH
+ if (skip == 0)
+ {
if (BASETYPE_VIA_VIRTUAL (type, i))
{
/* The virtual base class pointer might have been
gdb_byte *buf;
struct cleanup *back_to;
- buf = xmalloc (TYPE_LENGTH (baseclass));
+ buf = (gdb_byte *) xmalloc (TYPE_LENGTH (baseclass));
back_to = make_cleanup (xfree, buf);
if (target_read_memory (address + boffset, buf,
addr = value_address (val);
obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
sizeof (CORE_ADDR));
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
cp_print_value_fields (type, value_enclosing_type (val),
value_contents_for_printing (val),
value_embedded_offset (val), addr,