/* Helper routines for C++ support in GDB.
- Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 Free Software Foundation, Inc.
Contributed by MontaVista Software.
#include "defs.h"
#include "cp-support.h"
-#include "gdb_string.h"
+#include <string.h>
#include "demangle.h"
#include "gdb_assert.h"
#include "gdbcmd.h"
#include "safe-ctype.h"
-#include "psymtab.h"
-
#define d_left(dc) (dc)->u.s_binary.left
#define d_right(dc) (dc)->u.s_binary.right
return 0;
}
- /* If the type is a typedef, replace it. */
- if (TYPE_CODE (otype) == TYPE_CODE_TYPEDEF)
+ /* If the type is a typedef or namespace alias, replace it. */
+ if (TYPE_CODE (otype) == TYPE_CODE_TYPEDEF
+ || TYPE_CODE (otype) == TYPE_CODE_NAMESPACE)
{
long len;
int is_anon;
/* Get the real type of the typedef. */
type = check_typedef (otype);
+ /* If the symbol is a namespace and its type name is no different
+ than the name we looked up, this symbol is not a namespace
+ alias and does not need to be substituted. */
+ if (TYPE_CODE (otype) == TYPE_CODE_NAMESPACE
+ && strcmp (TYPE_NAME (type), name) == 0)
+ return 0;
+
is_anon = (TYPE_TAG_NAME (type) == NULL
&& (TYPE_CODE (type) == TYPE_CODE_ENUM
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
/* If it doesn't, or if that failed, then try to demangle the
name. */
- demangled_name = cplus_demangle (mangled_name, options);
+ demangled_name = gdb_demangle (mangled_name, options);
if (demangled_name == NULL)
return NULL;
return rtti_type;
}
+/* A wrapper for bfd_demangle. */
+
+char *
+gdb_demangle (const char *name, int options)
+{
+ return bfd_demangle (NULL, name, options);
+}
+
/* Don't allow just "maintenance cplus". */
static void