/* Support routines for manipulating internal types for GDB.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
#include "demangle.h"
#include "complaints.h"
#include "gdbcmd.h"
-#include "wrapper.h"
#include "cp-abi.h"
#include "gdb_assert.h"
#include "hashtab.h"
-
+#include "exceptions.h"
/* Initialize BADNESS constants. */
/* Return a typename for a struct/union/enum type without "struct ",
"union ", or "enum ". If the type has a NULL name, return NULL. */
-char *
+const char *
type_name_no_tag (const struct type *type)
{
if (TYPE_TAG_NAME (type) != NULL)
struct type *
lookup_unsigned_typename (const struct language_defn *language,
- struct gdbarch *gdbarch, char *name)
+ struct gdbarch *gdbarch, const char *name)
{
char *uns = alloca (strlen (name) + 10);
struct type *
lookup_signed_typename (const struct language_defn *language,
- struct gdbarch *gdbarch, char *name)
+ struct gdbarch *gdbarch, const char *name)
{
struct type *t;
char *uns = alloca (strlen (name) + 8);
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
{
- char *t_field_name = TYPE_FIELD_NAME (type, i);
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
{
if (!TYPE_TARGET_TYPE (type))
{
- char *name;
+ const char *name;
struct symbol *sym;
/* It is dangerous to call lookup_symbol if we are currently
&& opaque_type_resolution
&& !currently_reading_symtab)
{
- char *name = type_name_no_tag (type);
+ const char *name = type_name_no_tag (type);
struct type *newtype;
if (name == NULL)
types. */
else if (TYPE_STUB (type) && !currently_reading_symtab)
{
- char *name = type_name_no_tag (type);
+ const char *name = type_name_no_tag (type);
/* FIXME: shouldn't we separately check the TYPE_NAME and the
TYPE_TAG_NAME, and look in STRUCT_DOMAIN and/or VAR_DOMAIN
as appropriate? (this code was written before TYPE_NAME and
safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
{
struct ui_file *saved_gdb_stderr;
- struct type *type;
+ struct type *type = NULL; /* Initialize to keep gcc happy. */
+ volatile struct gdb_exception except;
/* Suppress error messages. */
saved_gdb_stderr = gdb_stderr;
gdb_stderr = ui_file_new ();
/* Call parse_and_eval_type() without fear of longjmp()s. */
- if (!gdb_parse_and_eval_type (p, length, &type))
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ type = parse_and_eval_type (p, length);
+ }
+
+ if (except.reason < 0)
type = builtin_type (gdbarch)->builtin_void;
/* Stop suppressing error messages. */
TYPE_N_BASECLASSES (type));
printfi_filtered (spaces, "nfn_fields %d\n",
TYPE_NFN_FIELDS (type));
- printfi_filtered (spaces, "nfn_fields_total %d\n",
- TYPE_NFN_FIELDS_TOTAL (type));
if (TYPE_N_BASECLASSES (type) > 0)
{
printfi_filtered (spaces, "virtual_field_bits (%d bits at *",