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
* [Bug c++/29215] Can't find nested type under strange circumstances (outer namespace or unrelated code built without debug info)
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 ` tromey at sourceware dot org
2022-10-21 20:16 ` dblaikie at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2022-10-21 19:14 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29215
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-10-21
Ever confirmed|0 |1
CC| |tromey at sourceware dot org
Status|UNCONFIRMED |NEW
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
This is a funny one. The problem is:
(gdb) show lang
The current source language is "auto; currently c".
This happens because 'main' does not have debuginfo
and so the current context is assumed to be C.
Doing "set lang c++" lets this work.
So probably the real question is why "x::t1" works :-)
Confirming this bug, but TBH I don't know if it is fixable
in a reasonable way. Arguably maybe C and C++ should be
closer together here, though in gdb "C" is also used as
a fallback when the language isn't known, so this may have
adverse consequences.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/29215] Can't find nested type under strange circumstances (outer namespace or unrelated code built without debug info)
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
1 sibling, 0 replies; 3+ messages in thread
From: dblaikie at gmail dot com @ 2022-10-21 20:16 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29215
--- Comment #2 from David Blaikie <dblaikie at gmail dot com> ---
Ah, thanks - FWIW, this wasn't found in the wild, just something I stumbled
across while reducing/understanding
https://sourceware.org/bugzilla/show_bug.cgi?id=29219 so I wouldn't find this
to be terribly important/high priority.
--
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).