/* 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 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GDB.
(1 or 2) of the character. */
void
-ada_emit_char (int c, struct ui_file *stream, int quoter, int type_len)
+ada_emit_char (int c, struct type *type, struct ui_file *stream,
+ int quoter, int type_len)
{
if (type_len != 2)
type_len = 1;
}
void
-ada_printchar (int c, struct ui_file *stream)
+ada_printchar (int c, struct type *type, struct ui_file *stream)
{
fputs_filtered ("'", stream);
- ada_emit_char (c, stream, '\'', 1);
+ ada_emit_char (c, type, stream, '\'', 1);
fputs_filtered ("'", stream);
}
break;
case TYPE_CODE_CHAR:
- LA_PRINT_CHAR ((unsigned char) val, stream);
+ LA_PRINT_CHAR ((unsigned char) val, type, stream);
break;
case TYPE_CODE_BOOL:
*/
static void
-printstr (struct ui_file *stream, const gdb_byte *string,
+printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
unsigned int length, int force_ellipses, int type_len,
const struct value_print_options *options)
{
in_quotes = 0;
}
fputs_filtered ("'", stream);
- ada_emit_char (char_at (string, i, type_len), stream, '\'',
+ ada_emit_char (char_at (string, i, type_len), elttype, stream, '\'',
type_len);
fputs_filtered ("'", stream);
fprintf_filtered (stream, _(" <repeats %u times>"), reps);
fputs_filtered ("\"", stream);
in_quotes = 1;
}
- ada_emit_char (char_at (string, i, type_len), stream, '"',
+ ada_emit_char (char_at (string, i, type_len), elttype, stream, '"',
type_len);
things_printed += 1;
}
}
void
-ada_printstr (struct ui_file *stream, const gdb_byte *string,
- unsigned int length, int width, int force_ellipses,
+ada_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
+ unsigned int length, int force_ellipses,
const struct value_print_options *options)
{
- printstr (stream, string, length, force_ellipses, width, options);
+ printstr (stream, type, string, length, force_ellipses, TYPE_LENGTH (type),
+ options);
}
len = temp_len;
}
- printstr (stream, valaddr, len, 0, eltlen, options);
+ printstr (stream, elttype, valaddr, len, 0, eltlen, options);
result = len;
}
else
struct value *func = ada_vax_float_print_function (type);
if (func != 0)
{
- static struct type *parray_of_char = NULL;
- struct value *printable_val;
-
- if (parray_of_char == NULL)
- parray_of_char =
- make_pointer_type
- (create_array_type
- (NULL, builtin_type_true_char,
- create_range_type (NULL, builtin_type_int32, 0, 32)), NULL);
-
- printable_val =
- value_ind (value_cast (parray_of_char,
- call_function_by_hand (func, 1,
- &val)));
-
- fprintf_filtered (stream, "%s", value_contents (printable_val));
+ CORE_ADDR addr;
+ addr = value_as_address (call_function_by_hand (func, 1, &val));
+ val_print_string (builtin_type_true_char,
+ addr, -1, stream, options);
return 0;
}
/* No special printing function. Do as best we can. */
{
fputs_filtered (" ", stream);
ada_printchar ((unsigned char) unpack_long (type, valaddr),
- stream);
+ type, stream);
}
}
return 0;