public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: TechHara <techhara@outlook.com>
To: Bug-gdb@gnu.org
Subject: Bug report -- Python Exception <class 'RecursionError'>: maximum recursion depth exceeded
Date: Wed, 08 Mar 2023 10:56:27 -0500	[thread overview]
Message-ID: <SJ1PR20MB4786281D99ECEA6906150F10DCB49@SJ1PR20MB4786.namprd20.prod.outlook.com> (raw)

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.



                 reply	other threads:[~2023-03-08 16:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ1PR20MB4786281D99ECEA6906150F10DCB49@SJ1PR20MB4786.namprd20.prod.outlook.com \
    --to=techhara@outlook.com \
    --cc=Bug-gdb@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).