int recurse;
enum val_prettyprint pretty;
{
- register unsigned int i;
+ register unsigned int i = 0; /* Number of characters printed */
unsigned len;
struct type *elttype;
unsigned eltlen;
LONGEST val;
- unsigned char c;
+ CORE_ADDR addr;
switch (TYPE_CODE (type))
{
{
print_spaces_filtered (2 + 2 * recurse, stream);
}
- fprintf_filtered (stream, "{");
/* For an array of chars, print with string syntax. */
if (eltlen == 1 && TYPE_CODE (elttype) == TYPE_CODE_INT
- && (format == 0 || format == 's') )
+ && (format == 0 || format == 's'))
{
LA_PRINT_STRING (stream, valaddr, len, 0);
+ i = len;
}
else
{
+ fprintf_filtered (stream, "{");
/* If this is a virtual function table, print the 0th
entry specially, and the rest of the members normally. */
if (cp_is_vtbl_ptr_type (elttype))
}
val_print_array_elements (type, valaddr, address, stream,
format, deref_ref, recurse, pretty, i);
+ fprintf_filtered (stream, "}");
}
- fprintf_filtered (stream, "}");
break;
}
/* Array of unspecified length: treat like pointer to first elt. */
- valaddr = (char *) &address;
+ addr = address;
+ goto print_unpacked_pointer;
case TYPE_CODE_PTR:
if (format && format != 's')
}
else
{
- CORE_ADDR addr = unpack_pointer (type, valaddr);
+ addr = unpack_pointer (type, valaddr);
+ print_unpacked_pointer:
elttype = TYPE_TARGET_TYPE (type);
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
if (addressprint && format != 's')
{
- fprintf_filtered (stream, "0x%x", addr);
+ fprintf_filtered (stream, "0x%lx", (unsigned long)addr);
}
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
- i = 0; /* Number of characters printed. */
- if (TYPE_LENGTH (elttype) == 1 &&
- TYPE_CODE (elttype) == TYPE_CODE_INT &&
- (format == 0 || format == 's') &&
- addr != 0 &&
- /* If print_max is UINT_MAX, the alloca below will fail.
- In that case don't try to print the string. */
- print_max < UINT_MAX)
+ if (TYPE_LENGTH (elttype) == 1
+ && TYPE_CODE (elttype) == TYPE_CODE_INT
+ && (format == 0 || format == 's')
+ && addr != 0)
{
- i = val_print_string (addr, stream);
+ i = val_print_string (addr, 0, stream);
}
else if (cp_is_vtbl_member(type))
{
if (vtblprint)
{
value vt_val;
+ struct symbol *wsym = (struct symbol *)NULL;
+ struct type *wtype;
+ struct symtab *s;
+ struct block *block = (struct block *)NULL;
+ int is_this_fld;
- vt_val = value_at (TYPE_TARGET_TYPE (type), vt_address);
+
+ wsym = lookup_symbol (SYMBOL_NAME(msymbol), block,
+ VAR_NAMESPACE, &is_this_fld, &s);
+
+ if (wsym)
+ {
+ wtype = SYMBOL_TYPE(wsym);
+ }
+ else
+ {
+ wtype = TYPE_TARGET_TYPE(type);
+ }
+ vt_val = value_at (wtype, vt_address);
val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val),
VALUE_ADDRESS (vt_val), stream, format,
deref_ref, recurse + 1, pretty);
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (builtin_type_int, valaddr);
+ val = unpack_long (type, valaddr);
for (i = 0; i < len; i++)
{
QUIT;
}
else
{
-#ifdef LONG_LONG
- fprintf_filtered (stream, "%lld", val);
-#else
- fprintf_filtered (stream, "%ld", val);
-#endif
+ print_longest (stream, 'd', 0, val);
}
break;
print_address_demangle (address, stream, demangle);
break;
+ case TYPE_CODE_BOOL:
+ /* Do something at least vaguely reasonable, for example if the
+ language is set wrong. */
+
case TYPE_CODE_INT:
format = format ? format : output_format;
if (format)