public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/17387] New: missing entries for multiple different typedefs with same name in .gdb_index
Date: Fri, 12 Sep 2014 19:49:00 -0000	[thread overview]
Message-ID: <bug-17387-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 17387
           Summary: missing entries for multiple different typedefs with
                    same name in .gdb_index
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: dje at google dot com

dwarf2read.c:write_psymbols only writes out one copy of each psym here:

      /* Only add a given psymbol once.  */
      slot = htab_find_slot (psyms_seen, psym, INSERT);
      if (!*slot)

which is in and of itself not a bad thing.  For some psyms we only want one
copy.

However, the typedef "mytype" in the attached example is defined in multiple
CUs and has different definitions in each.

This causes the output of "info types mytype" to be different with/without
gdb-generated .gdb_index:

Without gdb-generated .gdb_index:

bash$ gdb a.out
(gdb) info types mytype
All types matching regular expression "mytype":

File a.cc:
typedef A mytype;

File b.cc:
typedef A mytype;

File c.cc:
typedef A::B mytype;

With gdb-generated .gdb_index:

bash$ gdb a.out.2
(gdb) info types mytype
All types matching regular expression "mytype":

File a.cc:
typedef A mytype;

Perhaps a minor issue.  I'm not sure (yet) if there are more serious issues.
Since typedefs have static scope, and since we'll in general want to first look
in the current static scope before looking elsewhere (which we don't always do
right now), it might be that this will remain a minor issue.

Still, it's a bit odd: Why put any statically scoped symbols in the index then?
[and perhaps instead require the user to somehow always specify the desired CU:
e.g. by $pc or by file name or whatever]

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


             reply	other threads:[~2014-09-12 19:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12 19:49 dje at google dot com [this message]
2014-09-12 19:52 ` [Bug symtab/17387] " dje at google dot com
2014-09-12 19:53 ` dje at google dot com

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=bug-17387-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).