From 52eea4ce26affa9b2ba6e482ca9d752b7c52302a Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 28 Feb 2007 05:59:14 +0000 Subject: [PATCH] * stabsread.c (define_symbol): Create an associated STRUCT_DOMAIN symbol for Ada units when the symbol is defined using 't' rather than 'Tt' as symbol descriptor. --- gdb/ChangeLog | 6 ++++++ gdb/stabsread.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1cf9a347bb4..f14397f86c7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2007-02-07 Joel Brobecker + + * stabsread.c (define_symbol): Create an associated STRUCT_DOMAIN + symbol for Ada units when the symbol is defined using 't' rather + than 'Tt' as symbol descriptor. + 2007-02-28 Vladimir Prus * config/mips/tm-nbsd.h: Delete file. diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 1e7ae8bb37d..fa2510fbb2b 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1102,6 +1102,22 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, break; case 't': + /* In Ada, there is no distinction between typedef and non-typedef; + any type declaration implicitly has the equivalent of a typedef, + and thus 't' is in fact equivalent to 'Tt'. + + Therefore, for Ada units, we check the character immediately + before the 't', and if we do not find a 'T', then make sure to + create the associated symbol in the STRUCT_DOMAIN ('t' definitions + will be stored in the VAR_DOMAIN). If the symbol was indeed + defined as 'Tt' then the STRUCT_DOMAIN symbol will be created + elsewhere, so we don't need to take care of that. + + This is important to do, because of forward references: + The cleanup of undefined types stored in undef_types only uses + STRUCT_DOMAIN symbols to perform the replacement. */ + synonym = (SYMBOL_LANGUAGE (sym) == language_ada && p[-2] != 'T'); + /* Typedef */ SYMBOL_TYPE (sym) = read_type (&p, objfile); @@ -1185,6 +1201,24 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, } add_symbol_to_list (sym, &file_symbols); + + if (synonym) + { + /* Create the STRUCT_DOMAIN clone. */ + struct symbol *struct_sym = (struct symbol *) + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); + + *struct_sym = *sym; + SYMBOL_CLASS (struct_sym) = LOC_TYPEDEF; + SYMBOL_VALUE (struct_sym) = valu; + SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN; + if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) + TYPE_NAME (SYMBOL_TYPE (sym)) + = obconcat (&objfile->objfile_obstack, "", "", + DEPRECATED_SYMBOL_NAME (sym)); + add_symbol_to_list (struct_sym, &file_symbols); + } + break; case 'T': -- 2.30.2