public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dblaikie at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/29215] New: Can't find nested type under strange circumstances (outer namespace or unrelated code built without debug info)
Date: Tue, 31 May 2022 20:53:43 +0000	[thread overview]
Message-ID: <bug-29215-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29215
           Summary: Can't find nested type under strange circumstances
                    (outer namespace or unrelated code built without debug
                    info)
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: dblaikie at gmail dot com
  Target Milestone: ---

a.cpp:
```
void f1();
int main() {
  f1();
}
```
b.cpp:
```
namespace x {
struct t1 {
  t1();
  struct t2 {
    t2();
  };
};
}
x::t1::t1() { }
x::t1::t2::t2() { }
void f1() { }
```
Build the first without debug info, and the second with debug info and
pubnames/gdb-index:
```
$ clang++ -c a.cpp
$ clang++ -c b.cpp -g -ggnu-pubnames -Wl,--gdb-index
$ clang++ a.o b.o -fuse-ld=lld 
$ gdb -ex "ptype x::t1::t2" -ex "ptype x::t1" -ex quit a.out
No type "t1" within class or namespace "x".
type = struct x::t1 {
...
```
But if you add `-g -ggnu-pubnames` to a.cpp, or if you remove the namespace,
the name lookups do seem to work.

(reproduces with GCC-built DWARF too)

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

             reply	other threads:[~2022-05-31 20:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 20:53 dblaikie at gmail dot com [this message]
2022-10-21 19:14 ` [Bug c++/29215] " tromey at sourceware dot org
2022-10-21 20:16 ` dblaikie at gmail 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-29215-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).