aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2004-06-16 08:18:06 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2004-06-16 08:18:06 +0000
commit96d887e83094405969b939a2f9a1ad6e24785da6 (patch)
tree0656d90200e4099dd570482692fc56d964f62bcc /gdb/ada-lang.c
parent08fd625c2e51e1a4d90eaa63909f5ff0a209814a (diff)
downloadgdb-96d887e83094405969b939a2f9a1ad6e24785da6.zip
gdb-96d887e83094405969b939a2f9a1ad6e24785da6.tar.gz
gdb-96d887e83094405969b939a2f9a1ad6e24785da6.tar.bz2
* ada-tasks.c: Rename build_task_list to ada_build_task_list, and
make it non-static. * ada-lang.h (task_control_block): declaration moved from ada-task.c to ada-lang.h; this is needed to be able to implement the kill command in multi-task mode. (task_ptid): Ditto. (task_entry): Ditto. (task_list): Ditto. (ada_build_task_list): Ditto. * ada-lang.c: Conditionalize routines and data structures related to breakpoints, exceptions, completion, and symbol caching on GNAT_GDB, since these are not yet used in the submitted public sources. (ada_main_name): Editorial: Move definition out of exception-related code.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c707
1 files changed, 373 insertions, 334 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index f084f4f..643eb93 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -18,6 +18,19 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Sections of code marked
+
+ #ifdef GNAT_GDB
+ ...
+ #endif
+
+ indicate sections that are used in sources distributed by
+ ACT, Inc., but not yet integrated into the public tree (where
+ GNAT_GDB is not defined). They are retained here nevertheless
+ to minimize the problems of maintaining different versions
+ of the source and to make the full source available. */
+
#include "defs.h"
#include <stdio.h>
#include "gdb_string.h"
@@ -62,6 +75,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
#endif
+#ifdef GNAT_GDB
/* A structure that contains a vector of strings.
The main purpose of this type is to group the vector and its
associated parameters in one structure. This makes it easier
@@ -76,6 +90,7 @@ struct string_vector
static struct string_vector xnew_string_vector (int initial_size);
static void string_vector_append (struct string_vector *sv, char *str);
+#endif /* GNAT_GDB */
static const char *ada_unqualified_name (const char *decoded_name);
static char *add_angle_brackets (const char *str);
@@ -332,6 +347,8 @@ static struct obstack symbol_list_obstack;
/* Utilities */
+#ifdef GNAT_GDB
+
/* Create a new empty string_vector struct with an initial size of
INITIAL_SIZE. */
@@ -392,6 +409,8 @@ add_angle_brackets (const char *str)
return result;
}
+#endif /* GNAT_GDB */
+
static char *
ada_get_gdb_completer_word_break_characters (void)
{
@@ -705,6 +724,37 @@ ada_update_initial_language (enum language lang,
return lang;
}
+
+/* If the main procedure is written in Ada, then return its name.
+ The result is good until the next call. Return NULL if the main
+ procedure doesn't appear to be in Ada. */
+
+char *
+ada_main_name (void)
+{
+ struct minimal_symbol *msym;
+ CORE_ADDR main_program_name_addr;
+ static char main_program_name[1024];
+ /* For Ada, the name of the main procedure is stored in a specific
+ string constant, generated by the binder. Look for that symbol,
+ extract its address, and then read that string. If we didn't find
+ that string, then most probably the main procedure is not written
+ in Ada. */
+ msym = lookup_minimal_symbol (ADA_MAIN_PROGRAM_SYMBOL_NAME, NULL, NULL);
+
+ if (msym != NULL)
+ {
+ main_program_name_addr = SYMBOL_VALUE_ADDRESS (msym);
+ if (main_program_name_addr == 0)
+ error ("Invalid address for Ada main program name.");
+
+ extract_string (main_program_name_addr, main_program_name);
+ return main_program_name;
+ }
+
+ /* The main procedure doesn't seem to be in Ada. */
+ return NULL;
+}
/* Symbols */
@@ -3597,6 +3647,13 @@ ada_convert_actuals (struct value *func, int nargs, struct value *args[],
/* Experimental Symbol Cache Module */
+/* This module may well have been OBE, due to improvements in the
+ symbol-table module. So until proven otherwise, it is disabled in
+ the submitted public code, and may be removed from all sources
+ in the future. */
+
+#ifdef GNAT_GDB
+
/* This section implements a simple, fixed-sized hash table for those
Ada-mode symbols that get looked up in the course of executing the user's
commands. The size is fixed on the grounds that there are not
@@ -3686,6 +3743,22 @@ cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
e->symtab = symtab;
e->block = block;
}
+
+#else
+static int
+lookup_cached_symbol (const char *name, domain_enum namespace,
+ struct symbol **sym, struct block **block,
+ struct symtab **symtab)
+{
+ return 0;
+}
+
+static void
+cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
+ struct block *block, struct symtab *symtab)
+{
+}
+#endif /* GNAT_GDB */
/* Symbol Lookup */
@@ -3841,293 +3914,6 @@ defns_collected (struct obstack *obstackp, int finish)
return (struct ada_symbol_info *) obstack_base (obstackp);
}
-/* If SYM_NAME is a completion candidate for TEXT, return this symbol
- name in a form that's appropriate for the completion. The result
- does not need to be deallocated, but is only good until the next call.
-
- TEXT_LEN is equal to the length of TEXT.
- Perform a wild match if WILD_MATCH is set.
- ENCODED should be set if TEXT represents the start of a symbol name
- in its encoded form. */
-
-static const char *
-symbol_completion_match (const char *sym_name,
- const char *text, int text_len,
- int wild_match, int encoded)
-{
- char *result;
- const int verbatim_match = (text[0] == '<');
- int match = 0;
-
- if (verbatim_match)
- {
- /* Strip the leading angle bracket. */
- text = text + 1;
- text_len--;
- }
-
- /* First, test against the fully qualified name of the symbol. */
-
- if (strncmp (sym_name, text, text_len) == 0)
- match = 1;
-
- if (match && !encoded)
- {
- /* One needed check before declaring a positive match is to verify
- that iff we are doing a verbatim match, the decoded version
- of the symbol name starts with '<'. Otherwise, this symbol name
- is not a suitable completion. */
- const char *sym_name_copy = sym_name;
- int has_angle_bracket;
-
- sym_name = ada_decode (sym_name);
- has_angle_bracket = (sym_name [0] == '<');
- match = (has_angle_bracket == verbatim_match);
- sym_name = sym_name_copy;
- }
-
- if (match && !verbatim_match)
- {
- /* When doing non-verbatim match, another check that needs to
- be done is to verify that the potentially matching symbol name
- does not include capital letters, because the ada-mode would
- not be able to understand these symbol names without the
- angle bracket notation. */
- const char *tmp;
-
- for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
- if (*tmp != '\0')
- match = 0;
- }
-
- /* Second: Try wild matching... */
-
- if (!match && wild_match)
- {
- /* Since we are doing wild matching, this means that TEXT
- may represent an unqualified symbol name. We therefore must
- also compare TEXT against the unqualified name of the symbol. */
- sym_name = ada_unqualified_name (ada_decode (sym_name));
-
- if (strncmp (sym_name, text, text_len) == 0)
- match = 1;
- }
-
- /* Finally: If we found a mach, prepare the result to return. */
-
- if (!match)
- return NULL;
-
- if (verbatim_match)
- sym_name = add_angle_brackets (sym_name);
-
- if (!encoded)
- sym_name = ada_decode (sym_name);
-
- return sym_name;
-}
-
-/* A companion function to ada_make_symbol_completion_list().
- Check if SYM_NAME represents a symbol which name would be suitable
- to complete TEXT (TEXT_LEN is the length of TEXT), in which case
- it is appended at the end of the given string vector SV.
-
- ORIG_TEXT is the string original string from the user command
- that needs to be completed. WORD is the entire command on which
- completion should be performed. These two parameters are used to
- determine which part of the symbol name should be added to the
- completion vector.
- if WILD_MATCH is set, then wild matching is performed.
- ENCODED should be set if TEXT represents a symbol name in its
- encoded formed (in which case the completion should also be
- encoded). */
-
-static void
-symbol_completion_add (struct string_vector *sv,
- const char *sym_name,
- const char *text, int text_len,
- const char *orig_text, const char *word,
- int wild_match, int encoded)
-{
- const char *match = symbol_completion_match (sym_name, text, text_len,
- wild_match, encoded);
- char *completion;
-
- if (match == NULL)
- return;
-
- /* We found a match, so add the appropriate completion to the given
- string vector. */
-
- if (word == orig_text)
- {
- completion = xmalloc (strlen (match) + 5);
- strcpy (completion, match);
- }
- else if (word > orig_text)
- {
- /* Return some portion of sym_name. */
- completion = xmalloc (strlen (match) + 5);
- strcpy (completion, match + (word - orig_text));
- }
- else
- {
- /* Return some of ORIG_TEXT plus sym_name. */
- completion = xmalloc (strlen (match) + (orig_text - word) + 5);
- strncpy (completion, word, orig_text - word);
- completion[orig_text - word] = '\0';
- strcat (completion, match);
- }
-
- string_vector_append (sv, completion);
-}
-
-/* Return a list of possible symbol names completing TEXT0. The list
- is NULL terminated. WORD is the entire command on which completion
- is made. */
-
-char **
-ada_make_symbol_completion_list (const char *text0, const char *word)
-{
- /* Note: This function is almost a copy of make_symbol_completion_list(),
- except it has been adapted for Ada. It is somewhat of a shame to
- duplicate so much code, but we don't really have the infrastructure
- yet to develop a language-aware version of he symbol completer... */
- char *text;
- int text_len;
- int wild_match;
- int encoded;
- struct string_vector result = xnew_string_vector (128);
- struct symbol *sym;
- struct symtab *s;
- struct partial_symtab *ps;
- struct minimal_symbol *msymbol;
- struct objfile *objfile;
- struct block *b, *surrounding_static_block = 0;
- int i;
- struct dict_iterator iter;
-
- if (text0[0] == '<')
- {
- text = xstrdup (text0);
- make_cleanup (xfree, text);
- text_len = strlen (text);
- wild_match = 0;
- encoded = 1;
- }
- else
- {
- text = xstrdup (ada_encode (text0));
- make_cleanup (xfree, text);
- text_len = strlen (text);
- for (i = 0; i < text_len; i++)
- text[i] = tolower (text[i]);
-
- /* FIXME: brobecker/2003-09-17: When we get rid of ADA_RETAIN_DOTS,
- we can restrict the wild_match check to searching "__" only. */
- wild_match = (strstr (text0, "__") == NULL
- && strchr (text0, '.') == NULL);
- encoded = (strstr (text0, "__") != NULL);
- }
-
- /* First, look at the partial symtab symbols. */
- ALL_PSYMTABS (objfile, ps)
- {
- struct partial_symbol **psym;
-
- /* If the psymtab's been read in we'll get it when we search
- through the blockvector. */
- if (ps->readin)
- continue;
-
- for (psym = objfile->global_psymbols.list + ps->globals_offset;
- psym < (objfile->global_psymbols.list + ps->globals_offset
- + ps->n_global_syms);
- psym++)
- {
- QUIT;
- symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
- text, text_len, text0, word,
- wild_match, encoded);
- }
-
- for (psym = objfile->static_psymbols.list + ps->statics_offset;
- psym < (objfile->static_psymbols.list + ps->statics_offset
- + ps->n_static_syms);
- psym++)
- {
- QUIT;
- symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
- text, text_len, text0, word,
- wild_match, encoded);
- }
- }
-
- /* At this point scan through the misc symbol vectors and add each
- symbol you find to the list. Eventually we want to ignore
- anything that isn't a text symbol (everything else will be
- handled by the psymtab code above). */
-
- ALL_MSYMBOLS (objfile, msymbol)
- {
- QUIT;
- symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (msymbol),
- text, text_len, text0, word,
- wild_match, encoded);
- }
-
- /* Search upwards from currently selected frame (so that we can
- complete on local vars. */
-
- for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
- {
- if (!BLOCK_SUPERBLOCK (b))
- surrounding_static_block = b; /* For elmin of dups */
-
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
- text, text_len, text0, word,
- wild_match, encoded);
- }
- }
-
- /* Go through the symtabs and check the externs and statics for
- symbols which match. */
-
- ALL_SYMTABS (objfile, s)
- {
- QUIT;
- b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
- text, text_len, text0, word,
- wild_match, encoded);
- }
- }
-
- ALL_SYMTABS (objfile, s)
- {
- QUIT;
- b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
- /* Don't do this block twice. */
- if (b == surrounding_static_block)
- continue;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
- text, text_len, text0, word,
- wild_match, encoded);
- }
- }
-
- /* Append the closing NULL entry. */
- string_vector_append (&result, NULL);
-
- return (result.array);
-}
-
/* Look, in partial_symtab PST, for symbol NAME in given namespace.
Check the global symbols if GLOBAL, the static symbols if not.
Do wild-card match if WILD. */
@@ -5339,6 +5125,300 @@ ada_add_block_symbols (struct obstack *obstackp,
}
}
+#ifdef GNAT_GDB
+
+ /* Symbol Completion */
+
+/* If SYM_NAME is a completion candidate for TEXT, return this symbol
+ name in a form that's appropriate for the completion. The result
+ does not need to be deallocated, but is only good until the next call.
+
+ TEXT_LEN is equal to the length of TEXT.
+ Perform a wild match if WILD_MATCH is set.
+ ENCODED should be set if TEXT represents the start of a symbol name
+ in its encoded form. */
+
+static const char *
+symbol_completion_match (const char *sym_name,
+ const char *text, int text_len,
+ int wild_match, int encoded)
+{
+ char *result;
+ const int verbatim_match = (text[0] == '<');
+ int match = 0;
+
+ if (verbatim_match)
+ {
+ /* Strip the leading angle bracket. */
+ text = text + 1;
+ text_len--;
+ }
+
+ /* First, test against the fully qualified name of the symbol. */
+
+ if (strncmp (sym_name, text, text_len) == 0)
+ match = 1;
+
+ if (match && !encoded)
+ {
+ /* One needed check before declaring a positive match is to verify
+ that iff we are doing a verbatim match, the decoded version
+ of the symbol name starts with '<'. Otherwise, this symbol name
+ is not a suitable completion. */
+ const char *sym_name_copy = sym_name;
+ int has_angle_bracket;
+
+ sym_name = ada_decode (sym_name);
+ has_angle_bracket = (sym_name [0] == '<');
+ match = (has_angle_bracket == verbatim_match);
+ sym_name = sym_name_copy;
+ }
+
+ if (match && !verbatim_match)
+ {
+ /* When doing non-verbatim match, another check that needs to
+ be done is to verify that the potentially matching symbol name
+ does not include capital letters, because the ada-mode would
+ not be able to understand these symbol names without the
+ angle bracket notation. */
+ const char *tmp;
+
+ for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
+ if (*tmp != '\0')
+ match = 0;
+ }
+
+ /* Second: Try wild matching... */
+
+ if (!match && wild_match)
+ {
+ /* Since we are doing wild matching, this means that TEXT
+ may represent an unqualified symbol name. We therefore must
+ also compare TEXT against the unqualified name of the symbol. */
+ sym_name = ada_unqualified_name (ada_decode (sym_name));
+
+ if (strncmp (sym_name, text, text_len) == 0)
+ match = 1;
+ }
+
+ /* Finally: If we found a mach, prepare the result to return. */
+
+ if (!match)
+ return NULL;
+
+ if (verbatim_match)
+ sym_name = add_angle_brackets (sym_name);
+
+ if (!encoded)
+ sym_name = ada_decode (sym_name);
+
+ return sym_name;
+}
+
+/* A companion function to ada_make_symbol_completion_list().
+ Check if SYM_NAME represents a symbol which name would be suitable
+ to complete TEXT (TEXT_LEN is the length of TEXT), in which case
+ it is appended at the end of the given string vector SV.
+
+ ORIG_TEXT is the string original string from the user command
+ that needs to be completed. WORD is the entire command on which
+ completion should be performed. These two parameters are used to
+ determine which part of the symbol name should be added to the
+ completion vector.
+ if WILD_MATCH is set, then wild matching is performed.
+ ENCODED should be set if TEXT represents a symbol name in its
+ encoded formed (in which case the completion should also be
+ encoded). */
+
+static void
+symbol_completion_add (struct string_vector *sv,
+ const char *sym_name,
+ const char *text, int text_len,
+ const char *orig_text, const char *word,
+ int wild_match, int encoded)
+{
+ const char *match = symbol_completion_match (sym_name, text, text_len,
+ wild_match, encoded);
+ char *completion;
+
+ if (match == NULL)
+ return;
+
+ /* We found a match, so add the appropriate completion to the given
+ string vector. */
+
+ if (word == orig_text)
+ {
+ completion = xmalloc (strlen (match) + 5);
+ strcpy (completion, match);
+ }
+ else if (word > orig_text)
+ {
+ /* Return some portion of sym_name. */
+ completion = xmalloc (strlen (match) + 5);
+ strcpy (completion, match + (word - orig_text));
+ }
+ else
+ {
+ /* Return some of ORIG_TEXT plus sym_name. */
+ completion = xmalloc (strlen (match) + (orig_text - word) + 5);
+ strncpy (completion, word, orig_text - word);
+ completion[orig_text - word] = '\0';
+ strcat (completion, match);
+ }
+
+ string_vector_append (sv, completion);
+}
+
+/* Return a list of possible symbol names completing TEXT0. The list
+ is NULL terminated. WORD is the entire command on which completion
+ is made. */
+
+char **
+ada_make_symbol_completion_list (const char *text0, const char *word)
+{
+ /* Note: This function is almost a copy of make_symbol_completion_list(),
+ except it has been adapted for Ada. It is somewhat of a shame to
+ duplicate so much code, but we don't really have the infrastructure
+ yet to develop a language-aware version of he symbol completer... */
+ char *text;
+ int text_len;
+ int wild_match;
+ int encoded;
+ struct string_vector result = xnew_string_vector (128);
+ struct symbol *sym;
+ struct symtab *s;
+ struct partial_symtab *ps;
+ struct minimal_symbol *msymbol;
+ struct objfile *objfile;
+ struct block *b, *surrounding_static_block = 0;
+ int i;
+ struct dict_iterator iter;
+
+ if (text0[0] == '<')
+ {
+ text = xstrdup (text0);
+ make_cleanup (xfree, text);
+ text_len = strlen (text);
+ wild_match = 0;
+ encoded = 1;
+ }
+ else
+ {
+ text = xstrdup (ada_encode (text0));
+ make_cleanup (xfree, text);
+ text_len = strlen (text);
+ for (i = 0; i < text_len; i++)
+ text[i] = tolower (text[i]);
+
+ /* FIXME: brobecker/2003-09-17: When we get rid of ADA_RETAIN_DOTS,
+ we can restrict the wild_match check to searching "__" only. */
+ wild_match = (strstr (text0, "__") == NULL
+ && strchr (text0, '.') == NULL);
+ encoded = (strstr (text0, "__") != NULL);
+ }
+
+ /* First, look at the partial symtab symbols. */
+ ALL_PSYMTABS (objfile, ps)
+ {
+ struct partial_symbol **psym;
+
+ /* If the psymtab's been read in we'll get it when we search
+ through the blockvector. */
+ if (ps->readin)
+ continue;
+
+ for (psym = objfile->global_psymbols.list + ps->globals_offset;
+ psym < (objfile->global_psymbols.list + ps->globals_offset
+ + ps->n_global_syms);
+ psym++)
+ {
+ QUIT;
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+
+ for (psym = objfile->static_psymbols.list + ps->statics_offset;
+ psym < (objfile->static_psymbols.list + ps->statics_offset
+ + ps->n_static_syms);
+ psym++)
+ {
+ QUIT;
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (*psym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ /* At this point scan through the misc symbol vectors and add each
+ symbol you find to the list. Eventually we want to ignore
+ anything that isn't a text symbol (everything else will be
+ handled by the psymtab code above). */
+
+ ALL_MSYMBOLS (objfile, msymbol)
+ {
+ QUIT;
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (msymbol),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+
+ /* Search upwards from currently selected frame (so that we can
+ complete on local vars. */
+
+ for (b = get_selected_block (0); b != NULL; b = BLOCK_SUPERBLOCK (b))
+ {
+ if (!BLOCK_SUPERBLOCK (b))
+ surrounding_static_block = b; /* For elmin of dups */
+
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ /* Go through the symtabs and check the externs and statics for
+ symbols which match. */
+
+ ALL_SYMTABS (objfile, s)
+ {
+ QUIT;
+ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ ALL_SYMTABS (objfile, s)
+ {
+ QUIT;
+ b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+ /* Don't do this block twice. */
+ if (b == surrounding_static_block)
+ continue;
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ symbol_completion_add (&result, SYMBOL_LINKAGE_NAME (sym),
+ text, text_len, text0, word,
+ wild_match, encoded);
+ }
+ }
+
+ /* Append the closing NULL entry. */
+ string_vector_append (&result, NULL);
+
+ return (result.array);
+}
+
+#endif /* GNAT_GDB */
+
+#ifdef GNAT_GDB
/* Breakpoint-related */
/* Import message from symtab.c. */
@@ -6041,37 +6121,6 @@ extended_canonical_line_spec (struct symtab_and_line sal, const char *name)
return r;
}
-/* If the main procedure is written in Ada, then return its name.
- The result is good until the next call. Return NULL if the main
- procedure doesn't appear to be in Ada. */
-
-char *
-ada_main_name (void)
-{
- struct minimal_symbol *msym;
- CORE_ADDR main_program_name_addr;
- static char main_program_name[1024];
- /* For Ada, the name of the main procedure is stored in a specific
- string constant, generated by the binder. Look for that symbol,
- extract its address, and then read that string. If we didn't find
- that string, then most probably the main procedure is not written
- in Ada. */
- msym = lookup_minimal_symbol (ADA_MAIN_PROGRAM_SYMBOL_NAME, NULL, NULL);
-
- if (msym != NULL)
- {
- main_program_name_addr = SYMBOL_VALUE_ADDRESS (msym);
- if (main_program_name_addr == 0)
- error ("Invalid address for Ada main program name.");
-
- extract_string (main_program_name_addr, main_program_name);
- return main_program_name;
- }
-
- /* The main procedure doesn't seem to be in Ada. */
- return NULL;
-}
-
/* Return type of Ada breakpoint associated with bp_stat:
0 if not an Ada-specific breakpoint, 1 for break on specific exception,
2 for break on unhandled exception, 3 for assert. */
@@ -6079,12 +6128,8 @@ ada_main_name (void)
static int
ada_exception_breakpoint_type (bpstat bs)
{
-#ifdef GNAT_GDB
return ((! bs || ! bs->breakpoint_at) ? 0
: bs->breakpoint_at->break_on_exception);
-#else
- return 0;
-#endif
}
/* True iff FRAME is very likely to be that of a function that is
@@ -6285,7 +6330,6 @@ exception_name_from_cond (const char *condition)
int
ada_print_exception_breakpoint_nontask (struct breakpoint *b)
{
-#ifdef GNAT_GDB
if (b->break_on_exception == 1)
{
if (b->cond_string) /* the breakpoint is on a specific exception. */
@@ -6314,9 +6358,6 @@ ada_print_exception_breakpoint_nontask (struct breakpoint *b)
else
return 0;
return 1;
-#else
- return 0;
-#endif
}
/* Print task identifier for breakpoint B, if it is an Ada-specific
@@ -6325,13 +6366,11 @@ ada_print_exception_breakpoint_nontask (struct breakpoint *b)
void
ada_print_exception_breakpoint_task (struct breakpoint *b)
{
-#ifdef GNAT_GDB
if (b->task != 0)
{
ui_out_text (uiout, " task ");
ui_out_field_int (uiout, "task", b->task);
}
-#endif
}
int
@@ -6476,8 +6515,8 @@ ada_breakpoint_rewrite (char *arg, int *break_on_exceptionp)
}
return arg;
}
+#endif
-
/* Field Access */
/* True if field number FIELD_NUM in struct or union type TYPE is supposed
@@ -10098,7 +10137,7 @@ const struct language_defn ada_language_defn = {
#ifdef GNAT_GDB
ada_lookup_symbol,
ada_lookup_minimal_symbol,
-#endif
+#endif /* GNAT_GDB */
&ada_exp_descriptor,
parse,
ada_error,
@@ -10134,7 +10173,7 @@ const struct language_defn ada_language_defn = {
#ifdef GNAT_GDB
ada_translate_error_message, /* Substitute Ada-specific terminology
in errors and warnings. */
-#endif
+#endif /* GNAT_GDB */
LANG_MAGIC
};
@@ -10186,17 +10225,17 @@ _initialize_ada_language (void)
deprecated_register_gdbarch_swap (NULL, 0, build_ada_types);
add_language (&ada_language_defn);
+ varsize_limit = 65536;
#ifdef GNAT_GDB
add_show_from_set
(add_set_cmd ("varsize-limit", class_support, var_uinteger,
(char *) &varsize_limit,
"Set maximum bytes in dynamic-sized object.",
&setlist), &showlist);
-#endif
- varsize_limit = 65536;
+ obstack_init (&cache_space);
+#endif /* GNAT_GDB */
obstack_init (&symbol_list_obstack);
- obstack_init (&cache_space);
decoded_names_store = htab_create_alloc_ex
(256, htab_hash_string, (int (*) (const void *, const void *)) streq,