/* Support for printing Ada types for GDB, the GNU debugger.
- Copyright (C) 1986, 1988, 1989, 1991, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1986, 1988-1989, 1991, 1997-2004, 2007-2012 Free
+ Software Foundation, Inc.
This file is part of GDB.
parent_type = ada_parent_type (type);
if (ada_type_name (parent_type) != NULL)
- fprintf_filtered (stream, "new %s with record",
- decoded_type_name (parent_type));
+ {
+ const char *parent_name = decoded_type_name (parent_type);
+
+ /* If we fail to decode the parent type name, then use the parent
+ type name as is. Not pretty, but should never happen except
+ when the debugging info is incomplete or incorrect. This
+ prevents a crash trying to print a NULL pointer. */
+ if (parent_name == NULL)
+ parent_name = ada_type_name (parent_type);
+ fprintf_filtered (stream, "new %s with record", parent_name);
+ }
else if (parent_type == NULL && ada_is_tagged_type (type, 0))
fprintf_filtered (stream, "tagged record");
else
fprintf_filtered (stream, "%.*s: ",
ada_name_prefix_len (varstring), varstring);
- if (type_name != NULL && show <= 0)
+ if (type_name != NULL && show <= 0 && !ada_is_aligner_type (type))
{
fprintf_filtered (stream, "%.*s",
ada_name_prefix_len (type_name), type_name);
if (ada_is_aligner_type (type))
ada_print_type (ada_aligned_type (type), "", stream, show, level);
- else if (ada_is_constrained_packed_array_type (type))
- {
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
- {
- fprintf_filtered (stream, "access ");
- print_array_type (TYPE_TARGET_TYPE (type), stream, show, level);
- }
- else
- {
- print_array_type (type, stream, show, level);
- }
- }
+ else if (ada_is_constrained_packed_array_type (type)
+ && TYPE_CODE (type) != TYPE_CODE_PTR)
+ print_array_type (type, stream, show, level);
else
switch (TYPE_CODE (type))
{