This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/17856] New: ada-lang.c resaves in cache symbol it just found in cache


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]