sym = NULL;
- TRY
+ try
{
sym = lookup_symbol (name, 0, VAR_DOMAIN, 0).symbol;
}
- CATCH (except, RETURN_MASK_ALL)
+ catch (const gdb_exception &except)
{
return 0;
}
- END_CATCH
if (sym != NULL)
{
/* 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;
}
string_file buf;
- TRY
+ try
{
type_print (type, "", &buf, -1);
}
/* If type_print threw an exception, there is little point
in continuing, so just bow out gracefully. */
- CATCH (except, RETURN_MASK_ERROR)
+ catch (const gdb_exception_error &except)
{
return 0;
}
- END_CATCH
len = buf.size ();
name = (char *) obstack_copy0 (&info->obstack, buf.c_str (), len);
struct symbol *sym = NULL;
sym = NULL;
- TRY
+ try
{
sym = lookup_symbol (local_name.get (), 0,
VAR_DOMAIN, 0).symbol;
}
- CATCH (except, RETURN_MASK_ALL)
+ catch (const gdb_exception &except)
{
}
- END_CATCH
if (sym != NULL)
{
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);
/* Lookup the rtti type for a class name. */
struct type *
-cp_lookup_rtti_type (const char *name, struct block *block)
+cp_lookup_rtti_type (const char *name, const struct block *block)
{
struct symbol * rtti_sym;
struct type * rtti_type;