From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16357 invoked by alias); 7 Nov 2002 19:26:32 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16331 invoked from network); 7 Nov 2002 19:26:26 -0000 Received: from unknown (HELO mailsrv.otenet.gr) (195.170.0.5) by sources.redhat.com with SMTP; 7 Nov 2002 19:26:26 -0000 Received: from neutrino.particles.org (athe530-h028.otenet.gr [212.205.217.28]) by mailsrv.otenet.gr (8.12.6/8.12.6) with ESMTP id gA7JQMe7021841 for ; Thu, 7 Nov 2002 21:26:23 +0200 (EET) Received: (from anteater@localhost) by neutrino.particles.org (8.11.6/8.11.6) id gA7KkN703662 for gdb-patches@sources.redhat.com; Thu, 7 Nov 2002 22:46:23 +0200 Date: Thu, 07 Nov 2002 11:26:00 -0000 From: Elias Athanasopoulos To: gdb-patches@sources.redhat.com Subject: [PATCH/RFC] faster language identification Message-ID: <20021107224622.D1136@neutrino.particles.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-SW-Source: 2002-11/txt/msg00185.txt.bz2 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 * 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