#include "cp-abi.h"
#include "namespace.h"
#include <signal.h>
-#include "common/gdb_setjmp.h"
+#include "gdbsupport/gdb_setjmp.h"
#include "safe-ctype.h"
-#include "common/selftest.h"
+#include "gdbsupport/selftest.h"
#define d_left(dc) (dc)->u.s_binary.left
#define d_right(dc) (dc)->u.s_binary.right
{
sym = lookup_symbol (name, 0, VAR_DOMAIN, 0).symbol;
}
- catch (const gdb_exception_RETURN_MASK_ALL &except)
+ catch (const gdb_exception &except)
{
return 0;
}
/* Get the real type of the typedef. */
type = check_typedef (otype);
- /* If the symbol is a namespace and its type name is no different
+ /* If the symbol name is the same as the original type name,
+ don't substitute. That would cause infinite recursion in
+ symbol lookups, as the typedef symbol is often the first
+ found symbol in the symbol table.
+
+ However, this can happen in a number of situations, such as:
+
+ 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
+ alias and does not need to be substituted.
+
+ If the symbol is typedef and its type name is the same
+ as the symbol's name, e.g., "typedef struct foo foo;". */
+ if (TYPE_NAME (type) != nullptr
&& strcmp (TYPE_NAME (type), name) == 0)
return 0;
}
/* If type_print threw an exception, there is little point
in continuing, so just bow out gracefully. */
- catch (const gdb_exception_RETURN_MASK_ERROR &except)
+ catch (const gdb_exception_error &except)
{
return 0;
}
sym = lookup_symbol (local_name.get (), 0,
VAR_DOMAIN, 0).symbol;
}
- catch (const gdb_exception_RETURN_MASK_ALL &except)
+ catch (const gdb_exception &except)
{
}
we're completing / matching everything, avoid returning NULL
which would make callers interpret the result as an error. */
if (demangled_name[0] == '\0' && completion_mode)
- return gdb::unique_xmalloc_ptr<char> (xstrdup (""));
+ return make_unique_xstrdup ("");
gdb::unique_xmalloc_ptr<char> without_params
= cp_remove_params_1 (demangled_name, false);