aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul N. Hilfinger <hilfinger@adacore.com>2004-06-08 08:42:04 +0000
committerPaul N. Hilfinger <hilfinger@adacore.com>2004-06-08 08:42:04 +0000
commitf26caa111510d587da5a777082803dedef2f42eb (patch)
tree0aecbf277e1840f4fc11fc5eaa7e1264627da76c
parenteef0f186e0e66caa02fbaa192a4074e00b960d91 (diff)
downloadgdb-f26caa111510d587da5a777082803dedef2f42eb.zip
gdb-f26caa111510d587da5a777082803dedef2f42eb.tar.gz
gdb-f26caa111510d587da5a777082803dedef2f42eb.tar.bz2
2004-06-08 Paul N. Hilfinger <Hilfinger@gnat.com>
* ada-lang.c (lookup_symbol_in_language): New function to allow re-use of another language's symbol lookup code. (Placed here temporarily while Ada support is being integrated into the public tree). (restore_language): New auxiliary function for lookup_symbol_in_language. * ada-lang.h (lookup_symbol_in_language): Declare (Placed here temporarily while Ada support is being integrated into the public tree).
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/ada-lang.c24
-rw-r--r--gdb/ada-lang.h11
3 files changed, 47 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 501ec4b..370a5d9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2004-06-08 Paul N. Hilfinger <Hilfinger@gnat.com>
+
+ * ada-lang.c (lookup_symbol_in_language): New function to allow
+ re-use of another language's symbol lookup code. (Placed here
+ temporarily while Ada support is being integrated into the public
+ tree).
+ (restore_language): New auxiliary function for
+ lookup_symbol_in_language.
+ * ada-lang.h (lookup_symbol_in_language): Declare (Placed here
+ temporarily while Ada support is being integrated into the public
+ tree).
+
2004-06-08 Alexandre Oliva <aoliva@redhat.com>
* Makefile.in (check//%): New.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index e9daf1a..f084f4f 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4444,6 +4444,30 @@ add_symbols_from_enclosing_procs (struct obstack *obstackp,
#endif
}
+/* FIXME: The next two routines belong in symtab.c */
+
+static void restore_language (void* lang)
+{
+ set_language ((enum language) lang);
+}
+
+/* As for lookup_symbol, but performed as if the current language
+ were LANG. */
+
+struct symbol *
+lookup_symbol_in_language (const char *name, const struct block *block,
+ domain_enum domain, enum language lang,
+ int *is_a_field_of_this, struct symtab **symtab)
+{
+ struct cleanup *old_chain
+ = make_cleanup (restore_language, (void*) current_language->la_language);
+ struct symbol *result;
+ set_language (lang);
+ result = lookup_symbol (name, block, domain, is_a_field_of_this, symtab);
+ do_cleanups (old_chain);
+ return result;
+}
+
/* True if TYPE is definitely an artificial type supplied to a symbol
for which no debugging information was given in the symbol file. */
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 0ec47b4..0381eff 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -393,4 +393,15 @@ extern void ada_find_printable_frame (struct frame_info *fi);
extern void ada_reset_thread_registers (void);
+/* Look up a symbol by name using the search conventions of
+ a specific language (optional block, optional symtab).
+ FIXME: Should be symtab.h. */
+
+extern struct symbol *lookup_symbol_in_language (const char *,
+ const struct block *,
+ domain_enum,
+ enum language,
+ int *,
+ struct symtab **);
+
#endif