Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Elias Athanasopoulos <eathan@otenet.gr>
To: gdb-patches@sources.redhat.com
Subject: [PATCH/RFC] faster language identification
Date: Thu, 07 Nov 2002 11:26:00 -0000	[thread overview]
Message-ID: <20021107224622.D1136@neutrino.particles.org> (raw)

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


             reply	other threads:[~2002-11-07 19:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-07 11:26 Elias Athanasopoulos [this message]
2002-11-07 11:33 ` Daniel Jacobowitz
2002-11-07 11:43   ` Elias Athanasopoulos
2002-11-07 11:47     ` Daniel Jacobowitz
2002-11-07 11:58       ` Elias Athanasopoulos
2002-11-07 12:55         ` Michael Snyder
2002-11-10  5:43           ` Elias Athanasopoulos
2002-11-10 11:03             ` Daniel Jacobowitz
2002-11-13 10:01               ` Jim Blandy
2002-11-13 10:11                 ` Daniel Jacobowitz
2002-11-13 10:39                   ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021107224622.D1136@neutrino.particles.org \
    --to=eathan@otenet.gr \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox