public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/109064] New: Maximum recursion depth exceeded in std::shared_ptr xmethod
@ 2023-03-08 12:04 ks1322 at gmail dot com
  2023-03-08 16:17 ` [Bug libstdc++/109064] " ks1322 at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ks1322 at gmail dot com @ 2023-03-08 12:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109064

            Bug ID: 109064
           Summary: Maximum recursion depth exceeded in std::shared_ptr
                    xmethod
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ks1322 at gmail dot com
  Target Milestone: ---

Based on
https://stackoverflow.com/questions/75652764/gdb-fails-with-python-exception-class-recursionerror-maximum-recursion-dep

Seems that trying to print unique() and use_count() in GDB for std::shared_ptr
causes infinite recursion in Python xmethods.

For this code:
```
#include <iostream>
#include <memory>

int main() {
    auto ptr = std::make_shared<int>(0);
    std::cout << ptr.use_count() << "\n";
    return 0;
}
```

Buid with:
```
g++ -g main.cc
```

Results in "maximum recursion depth exceeded" error
```
$ gdb -batch -ex "b 7" -ex r -ex "p ptr.use_count()" -ex "p ptr.unique()" a.out
Breakpoint 1 at 0x40122f: file /tmp/main.cc, line 7.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
1

Breakpoint 1, main () at /tmp/main.cc:7
7           return 0;
Python Exception <class 'RecursionError'>: maximum recursion depth exceeded
Error while looking for matching xmethod workers defined in Python.
Python Exception <class 'RecursionError'>: maximum recursion depth exceeded
Error while looking for matching xmethod workers defined in Python.
```

As a workaround xmethods can be disabled with
```
(gdb) disable xmethod
```

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

end of thread, other threads:[~2023-04-27 23:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 12:04 [Bug libstdc++/109064] New: Maximum recursion depth exceeded in std::shared_ptr xmethod ks1322 at gmail dot com
2023-03-08 16:17 ` [Bug libstdc++/109064] " ks1322 at gmail dot com
2023-03-10 10:37 ` redi at gcc dot gnu.org
2023-03-10 11:36 ` redi at gcc dot gnu.org
2023-03-10 11:36 ` cvs-commit at gcc dot gnu.org
2023-03-10 11:37 ` redi at gcc dot gnu.org
2023-03-20 11:54 ` cvs-commit at gcc dot gnu.org
2023-04-27 22:01 ` cvs-commit at gcc dot gnu.org
2023-04-27 23:04 ` cvs-commit at gcc dot gnu.org
2023-04-27 23:05 ` redi at gcc dot gnu.org

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).