This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH/RFC] faster language identification
- From: Elias Athanasopoulos <eathan at otenet dot gr>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 7 Nov 2002 22:46:22 +0200
- Subject: [PATCH/RFC] faster language identification
Hi all,
DWARFx encodes the language. In such a case, I think it is more
reliable to get the language from the object, instead of looking at the
source files' extensions.
Comments?
Elias
ChangeLog
2002-11-07 Elias Athanasopoulos <eathan@otenet.gr>
* symfile.c (symbol_file_add): Read the first partial symbol
table.
(symbol_file_add_main_1): Store the return value of symbol_file_add
to objfile. Check if we have already identify the language and set
it, otherwise call set_initial_language.
===================================================================
RCS file: /home/anteater/bucvs/src/gdb/symfile.c,v
retrieving revision 1.1
diff -u -p -r1.1 /home/anteater/bucvs/src/gdb/symfile.c
--- /home/anteater/bucvs/src/gdb/symfile.c 2002/11/07 20:36:37 1.1
+++ /home/anteater/bucvs/src/gdb/symfile.c 2002/11/07 20:36:59
@@ -877,7 +877,13 @@ symbol_file_add (char *name, int from_tt
}
syms_from_objfile (objfile, addrs, mainline, from_tty);
}
-
+
+ /* Read the first partial symbol table. This may help us to identify
+ the language of the object, faster and more reliable, if the object
+ contains DWARF information. */
+
+ psymtab_to_symtab (objfile->psymtabs);
+
/* We now have at least a partial symbol table. Check to see if the
user requested that all symbols be read on initial access via either
the gdb startup command line or on a per symbol file basis. Expand
@@ -939,7 +945,10 @@ symbol_file_add_main (char *args, int fr
static void
symbol_file_add_main_1 (char *args, int from_tty, int flags)
{
- symbol_file_add (args, from_tty, NULL, 1, flags);
+ struct objfile *objfile;
+ enum language lang = language_unknown;
+
+ objfile = symbol_file_add (args, from_tty, NULL, 1, flags);
#ifdef HPUXHPPA
RESET_HP_UX_GLOBALS ();
@@ -949,7 +958,17 @@ symbol_file_add_main_1 (char *args, int
what is frameless. */
reinit_frame_cache ();
- set_initial_language ();
+ /* DWARF supports language encoding along with the debugging
+ information. If we have a DWARF object, we might have
+ already grabbed the language. Read the comment before
+ set_initial_language(). */
+ if (objfile->psymtabs->symtab != NULL)
+ lang = objfile->psymtabs->symtab->language;
+
+ if (lang != language_unknown)
+ set_language (lang);
+ else
+ set_initial_language ();
}
void