public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29219] New: can't find C++ nested class name when using gdb_index and nested class is declared-but-not-defined in some CUs
@ 2022-06-01 19:13 dblaikie at gmail dot com
  0 siblings, 0 replies; only message in thread
From: dblaikie at gmail dot com @ 2022-06-01 19:13 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29219
           Summary: can't find C++ nested class name when using gdb_index
                    and nested class is declared-but-not-defined in some
                    CUs
           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: ---

test.h:
```
struct t1 {
  struct t2;
};
#ifndef LOCAL_DEF
struct t1::t2 {
};
#endif
```
test.cpp:
```
#include "test.h"
static t1 v1;
#ifndef REF_NESTED
static t1::t2 *v2;
#endif
int main() {}
```
test2.cpp:
```
#include "test.h"
#ifdef LOCAL_DEF
struct t1::t2 {};
#endif
static t1 v1;
static t1::t2 v2;
void f1() {}
```
Built/tested as:
```
$ g++-11 -g -ggnu-pubnames -Wl,--gdb-index test2.cpp test.cpp -fuse-ld=gold
$ gdb -ex "ptype t1::t2" -ex "ptype t1" -ex quit a.out
There is no field named t2
type = struct t1 {
$ g++-11 -g -ggnu-pubnames -Wl,--gdb-index test2.cpp test.cpp -fuse-ld=gold
-DREF_NESTED
$ gdb -ex "ptype t1::t2" -ex "ptype t1" -ex quit a.out
type = struct t1::t2 {
type = struct t1 {
$ g++-11 -g -ggnu-pubnames -Wl,--gdb-index test2.cpp test.cpp -fuse-ld=gold
-DREF_NESTED -DLOCAL_DEF
$ gdb -ex "ptype t1::t2" -ex "ptype t1" -ex quit a.out
There is no field named t2
type = struct t1 {
```

This is a bit more of an issue for clang, since it more aggressively demotes
types that are defined to declarations (producing debug info similar to the
last example above).

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-01 19:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 19:13 [Bug c++/29219] New: can't find C++ nested class name when using gdb_index and nested class is declared-but-not-defined in some CUs 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).