public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch +noconst 2/2] Unify lookup_symbol_in_objfile_symtabs
Date: Wed, 03 Dec 2014 17:07:00 -0000	[thread overview]
Message-ID: <20141203170714.GE25020@host2.jankratochvil.net> (raw)

2014-12-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* symtab.c (lookup_symbol_in_objfile_symtabs): New declaration.
	(lookup_global_symbol_from_objfile): Call it.

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6d50ebe..213bd4e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -79,6 +79,11 @@ struct symbol *lookup_local_symbol (const char *name,
 				    const domain_enum domain,
 				    enum language language);
 
+static struct symbol *
+  lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
+				    int block_index, const char *name,
+				    const domain_enum domain);
+
 static
 struct symbol *lookup_symbol_via_quick_fns (struct objfile *objfile,
 					    int block_index,
@@ -1546,24 +1551,12 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
        objfile;
        objfile = objfile_separate_debug_iterate (main_objfile, objfile))
     {
-      struct compunit_symtab *cust;
       struct symbol *sym;
-
-      /* Go through symtabs.  */
-      ALL_OBJFILE_COMPUNITS (objfile, cust)
-	{
-	  const struct blockvector *bv;
-	  const struct block *block;
-
-	  bv = COMPUNIT_BLOCKVECTOR (cust);
-	  block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-	  sym = block_lookup_symbol (block, name, domain);
-	  if (sym)
-	    {
-	      block_found = block;
-	      return fixup_symbol_section (sym, objfile);
-	    }
-	}
+      
+      sym = lookup_symbol_in_objfile_symtabs (objfile, GLOBAL_BLOCK, name,
+					      domain);
+      if (sym != NULL)
+	return sym;
 
       sym = lookup_symbol_via_quick_fns (objfile, GLOBAL_BLOCK, name, domain);
       if (sym)

             reply	other threads:[~2014-12-03 17:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 17:07 Jan Kratochvil [this message]
2014-12-05 18:05 ` Doug Evans
2014-12-05 18:41   ` [commit] " Jan Kratochvil

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=20141203170714.GE25020@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).