/* Support for printing Ada types for GDB, the GNU debugger.
- Copyright (C) 1986-2015 Free Software Foundation, Inc.
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
This file is part of GDB.
set *N past the bound and its delimiter, if any. */
static void
-print_range_bound (struct type *type, char *bounds, int *n,
+print_range_bound (struct type *type, const char *bounds, int *n,
struct ui_file *stream)
{
LONGEST B;
else
{
int bound_len;
- char *bound = bounds + *n;
- char *pend;
+ const char *bound = bounds + *n;
+ const char *pend;
pend = strstr (bound, "__");
if (pend == NULL)
print_dynamic_range_bound (struct type *type, const char *name, int name_len,
const char *suffix, struct ui_file *stream)
{
- static char *name_buf = NULL;
- static size_t name_buf_len = 0;
LONGEST B;
- int OK;
+ std::string name_buf (name, name_len);
+ name_buf += suffix;
- GROW_VECT (name_buf, name_buf_len, name_len + strlen (suffix) + 1);
- strncpy (name_buf, name, name_len);
- strcpy (name_buf + name_len, suffix);
-
- B = get_int_var_value (name_buf, &OK);
- if (OK)
+ if (get_int_var_value (name_buf.c_str (), B))
ada_print_scalar (type, B, stream);
else
fprintf_filtered (stream, "?");
else
{
int prefix_len = subtype_info - name;
- char *bounds_str;
+ const char *bounds_str;
int n;
subtype_info += 5;
print_fixed_point_type (struct type *type, struct ui_file *stream)
{
DOUBLEST delta = ada_delta (type);
- DOUBLEST small = ada_fixed_to_float (type, 1.0);
+ DOUBLEST small = ada_fixed_to_float (type, 1);
if (delta < 0.0)
fprintf_filtered (stream, "delta ??");
{
int i, len = TYPE_NFIELDS (type);
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
+ if (TYPE_TARGET_TYPE (type) != NULL
+ && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
fprintf_filtered (stream, "procedure");
else
fprintf_filtered (stream, "function");
fprintf_filtered (stream, ")");
}
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ if (TYPE_TARGET_TYPE (type) == NULL)
+ fprintf_filtered (stream, " return <unknown return type>");
+ else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
{
fprintf_filtered (stream, " return ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags);