public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/18258] New: Non-opaque type preference needs to take into account included symtabs
@ 2015-04-13 19:32 dje at google dot com
  2015-04-17  0:03 ` [Bug symtab/18258] " dje at google dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dje at google dot com @ 2015-04-13 19:32 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 18258
           Summary: Non-opaque type preference needs to take into account
                    included symtabs
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

I don't have a reportable testcase for this, but I want to write this down
while it's fresh.

This loop in dw2_lookup_symbol:

      while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
        {
          struct symbol *sym = NULL;
          struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu);
          const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
          struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);

          /* Some caution must be observed with overloaded functions            
             and methods, since the index will not contain any overload         
             information (but NAME might contain it).  */
          sym = block_lookup_symbol (block, name, domain);

          if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
            {
              if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
                return stab;

              stab_best = stab;
            }

          /* Keep looking through other CUs.  */
        }

doesn't take into account the fact that "stab" can actually be a list of
multiple symbol tables (stab->includes). In the program where I'm seeing the
problem:

(top-gdb) p stab->includes[0]@5
$161 =   {[0] = 0x1810cd0,
  [1] = 0xa94ed90,  <<< has opaque definition
  [2] = 0x10bfb7b0,  <<< has full definition
  [3] = 0x10e4ba90,
  [4] = 0x0}

So we find the opaque definition, and will never see the full definition,
unless the user happens to do something that causes 0x10bfb7b0 to be read in
via another symtab.

-- 
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 symtab/18258] Non-opaque type preference needs to take into account included symtabs
  2015-04-13 19:32 [Bug symtab/18258] New: Non-opaque type preference needs to take into account included symtabs dje at google dot com
@ 2015-04-17  0:03 ` dje at google dot com
  2015-05-27 18:53 ` cvs-commit at gcc dot gnu.org
  2015-05-27 18:54 ` dje at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: dje at google dot com @ 2015-04-17  0:03 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from dje at google dot com ---
Patch submitted:
https://sourceware.org/ml/gdb-patches/2015-04/msg00636.html

-- 
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 symtab/18258] Non-opaque type preference needs to take into account included symtabs
  2015-04-13 19:32 [Bug symtab/18258] New: Non-opaque type preference needs to take into account included symtabs dje at google dot com
  2015-04-17  0:03 ` [Bug symtab/18258] " dje at google dot com
@ 2015-05-27 18:53 ` cvs-commit at gcc dot gnu.org
  2015-05-27 18:54 ` dje at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-05-27 18:53 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Doug Evans <devans@sourceware.org>:

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

commit b2e2f908b863c27abb00108a03ebe2598baec55c
Author: Doug Evans <dje@google.com>
Date:   Wed May 27 11:50:38 2015 -0700

    PR symtab/18258

    gdb/ChangeLog:

        * block.c (block_find_symbol): New function.
        (block_find_non_opaque_type): Ditto.
        (block_find_non_opaque_type_preferred): Ditto.
        * block.h (block_symbol_matcher_ftype): New typedef.
        (block_find_symbol): Declare.
        (block_find_non_opaque_type): Ditto.
        (block_find_non_opaque_type_preferred): Ditto.
        * dwarf2read.c (dw2_lookup_symbol): Call block_find_symbol.
        * psymtab.c (psym_lookup_symbol): Ditto.
        * symtab.c (basic_lookup_transparent_type_1): New function.
        (basic_lookup_transparent_type): Call it.

    gdb/testsuite/ChangeLog:

        * gdb.dwarf2/opaque-type-lookup-2.c: New file.
        * gdb.dwarf2/opaque-type-lookup.c: New file.
        * gdb.dwarf2/opaque-type-lookup.exp: New file.

-- 
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 symtab/18258] Non-opaque type preference needs to take into account included symtabs
  2015-04-13 19:32 [Bug symtab/18258] New: Non-opaque type preference needs to take into account included symtabs dje at google dot com
  2015-04-17  0:03 ` [Bug symtab/18258] " dje at google dot com
  2015-05-27 18:53 ` cvs-commit at gcc dot gnu.org
@ 2015-05-27 18:54 ` dje at google dot com
  2 siblings, 0 replies; 4+ messages in thread
From: dje at google dot com @ 2015-05-27 18:54 UTC (permalink / raw)
  To: gdb-prs

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

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from dje at google dot com ---
patch committed

-- 
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-05-27 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-13 19:32 [Bug symtab/18258] New: Non-opaque type preference needs to take into account included symtabs dje at google dot com
2015-04-17  0:03 ` [Bug symtab/18258] " dje at google dot com
2015-05-27 18:53 ` cvs-commit at gcc dot gnu.org
2015-05-27 18:54 ` dje at google 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).