public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/17856] New: ada-lang.c resaves in cache symbol it just found in cache
@ 2015-01-18  5:13 xdje42 at gmail dot com
  2015-02-02  3:40 ` [Bug ada/17856] " cvs-commit at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xdje42 at gmail dot com @ 2015-01-18  5:13 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17856

            Bug ID: 17856
           Summary: ada-lang.c resaves in cache symbol it just found in
                    cache
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ada
          Assignee: unassigned at sourceware dot org
          Reporter: xdje42 at gmail dot com

After fixing PR 17854 and single-stepping through
ada_lookup_symbol_list_worker I see it trying to save
in the cache a symbol it just found in the cache.

In the snippet below, we've already called lookup_cached_symbol
and found the symbol.  We then "goto done" which later calls cache_symbol.

I don't know ada too well so I'm not sure what the right fix is here
(at least not yet).

  /* No non-global symbols found.  Check our cache to see if we have            
     already performed this search before.  If we have, then return             
     the same result.  */

  cacheIfUnique = 1;
  if (lookup_cached_symbol (name0, namespace, &sym, &block))
    {
      if (sym != NULL)
        add_defn_to_vec (&symbol_list_obstack, sym, block);
      goto done;
    }

  /* Search symbols from all global blocks.  */

  add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 1,
                        wild_match_p);

  /* Now add symbols from all per-file blocks if we've gotten no hits           
     (not strictly correct, but perhaps better than an error).  */

  if (num_defns_collected (&symbol_list_obstack) == 0)
    add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 0,
                          wild_match_p);

done:
  ndefns = num_defns_collected (&symbol_list_obstack);
  *results = defns_collected (&symbol_list_obstack, 1);

  ndefns = remove_extra_symbols (*results, ndefns);

  if (ndefns == 0 && full_search)
    cache_symbol (name0, namespace, NULL, NULL);

  if (ndefns == 1 && full_search && cacheIfUnique)
=>  cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block);

  ndefns = remove_irrelevant_renamings (*results, ndefns, block0);

  return ndefns;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug ada/17856] ada-lang.c resaves in cache symbol it just found in cache
  2015-01-18  5:13 [Bug ada/17856] New: ada-lang.c resaves in cache symbol it just found in cache xdje42 at gmail dot com
@ 2015-02-02  3:40 ` cvs-commit at gcc dot gnu.org
  2015-02-02  4:21 ` cvs-commit at gcc dot gnu.org
  2015-02-02  4:22 ` brobecker at gnat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-02-02  3:40 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17856

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joel Brobecker <brobecke@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b1eedac962b9d935ecb40725a614f6fa6cb0783a

commit b1eedac962b9d935ecb40725a614f6fa6cb0783a
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Mon Feb 2 07:28:12 2015 +0400

    [Ada] Do not re-cache symbol-lookup result found from cache lookup.

    When ada-lang.c:ada_lookup_symbol_list_worker finds a match in
    the symbol cache, it caches the result again, which is unecessary.
    This patch fixes the code to avoid that.

    gdb/ChangeLog:

            PR gdb/17856:
            * ada-lang.c (ada_lookup_symbol_list_worker): Do not re-cache
            results found in the cache.

    Tested on x86_64-linux, no regression.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug ada/17856] ada-lang.c resaves in cache symbol it just found in cache
  2015-01-18  5:13 [Bug ada/17856] New: ada-lang.c resaves in cache symbol it just found in cache xdje42 at gmail dot com
  2015-02-02  3:40 ` [Bug ada/17856] " cvs-commit at gcc dot gnu.org
@ 2015-02-02  4:21 ` cvs-commit at gcc dot gnu.org
  2015-02-02  4:22 ` brobecker at gnat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-02-02  4:21 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17856

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-7.9-branch branch has been updated by Joel Brobecker
<brobecke@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b9f28929592990231bdce7b44369afc184a55f5d

commit b9f28929592990231bdce7b44369afc184a55f5d
Author: Joel Brobecker <brobecker@adacore.com>
Date:   Mon Feb 2 07:28:12 2015 +0400

    [Ada] Do not re-cache symbol-lookup result found from cache lookup.

    When ada-lang.c:ada_lookup_symbol_list_worker finds a match in
    the symbol cache, it caches the result again, which is unecessary.
    This patch fixes the code to avoid that.

    gdb/ChangeLog:

            PR gdb/17856:
            * ada-lang.c (ada_lookup_symbol_list_worker): Do not re-cache
            results found in the cache.

    Tested on x86_64-linux, no regression.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug ada/17856] ada-lang.c resaves in cache symbol it just found in cache
  2015-01-18  5:13 [Bug ada/17856] New: ada-lang.c resaves in cache symbol it just found in cache xdje42 at gmail dot com
  2015-02-02  3:40 ` [Bug ada/17856] " cvs-commit at gcc dot gnu.org
  2015-02-02  4:21 ` cvs-commit at gcc dot gnu.org
@ 2015-02-02  4:22 ` brobecker at gnat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: brobecker at gnat dot com @ 2015-02-02  4:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=17856

Joel Brobecker <brobecker at gnat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |brobecker at gnat dot com
         Resolution|---                         |FIXED

--- Comment #3 from Joel Brobecker <brobecker at gnat dot com> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-02  4:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-18  5:13 [Bug ada/17856] New: ada-lang.c resaves in cache symbol it just found in cache xdje42 at gmail dot com
2015-02-02  3:40 ` [Bug ada/17856] " cvs-commit at gcc dot gnu.org
2015-02-02  4:21 ` cvs-commit at gcc dot gnu.org
2015-02-02  4:22 ` brobecker at gnat dot com

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).