public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29215] New: Can't find nested type under strange circumstances (outer namespace or unrelated code built without debug info)
@ 2022-05-31 20:53 dblaikie at gmail dot com
  2022-10-21 19:14 ` [Bug c++/29215] " tromey at sourceware dot org
  2022-10-21 20:16 ` dblaikie at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: dblaikie at gmail dot com @ 2022-05-31 20:53 UTC (permalink / raw)
  To: gdb-prs

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.

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

end of thread, other threads:[~2022-10-21 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 20:53 [Bug c++/29215] New: Can't find nested type under strange circumstances (outer namespace or unrelated code built without debug info) dblaikie at gmail dot com
2022-10-21 19:14 ` [Bug c++/29215] " tromey at sourceware dot org
2022-10-21 20:16 ` dblaikie at gmail 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).