public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Bug report -- Python Exception <class 'RecursionError'>: maximum recursion depth exceeded
@ 2023-03-08 15:56 TechHara
  0 siblings, 0 replies; only message in thread
From: TechHara @ 2023-03-08 15:56 UTC (permalink / raw)
  To: Bug-gdb

Hello,

I am reporting a bug that I found. The following script reproduces the
bug on Ubuntu x64 running g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 and
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1.

```
cat << EOF > main.cc
#include <iostream>
#include <memory>

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

g++ -std=c++17 -g main.cc
./a.out
gdb -q a.out -ex "set confirm off" -ex "b 7" -ex "r" -ex "p
ptr.use_count()" -ex "q"
```

The output of the script is
```
(gdb) p ptr.use_count()
Python Exception <class 'RecursionError'>: maximum recursion depth
exceeded
Error while looking for matching xmethod workers defined in Python.
```

With python print-stack full enabled, I get
```
(gdb) set python print-stack full
(gdb) p ptr.use_count()
Traceback (most recent call last):
  File "/lib/x86_64-linux-
gnu/../../share/gcc/python/libstdcxx/v6/xmethods.py", line 777, in
match
    worker = method.worker_class(class_type.template_argument(0))
  File "/lib/x86_64-linux-
gnu/../../share/gcc/python/libstdcxx/v6/xmethods.py", line 733, in
__init__
    SharedPtrUseCountWorker.__init__(self, elem_type)
  File "/lib/x86_64-linux-
gnu/../../share/gcc/python/libstdcxx/v6/xmethods.py", line 733, in
__init__
    SharedPtrUseCountWorker.__init__(self, elem_type)
  File "/lib/x86_64-linux-
gnu/../../share/gcc/python/libstdcxx/v6/xmethods.py", line 733, in
__init__
    SharedPtrUseCountWorker.__init__(self, elem_type)
  [Previous line repeated 995 more times]
RecursionError: maximum recursion depth exceeded
Error while looking for matching xmethod workers defined in Python.
```

If I were to compile with clang and run the same commands with GDB,
1) -stdlib=libstdc++ ==> same error
2) -stdlib=libc++ ==> works fine

LLDB, on the other hand, works fine on all scenarios I tested.

Thanks.



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

only message in thread, other threads:[~2023-03-08 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 15:56 Bug report -- Python Exception <class 'RecursionError'>: maximum recursion depth exceeded TechHara

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