This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: recursion limit exceeded in Python API, but there's only one function in traceback
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Paul_Koning at dell dot com
- Cc: omeragacan at gmail dot com, gdb at sourceware dot org
- Date: Thu, 16 Oct 2014 16:12:50 +0100
- Subject: Re: recursion limit exceeded in Python API, but there's only one function in traceback
- Authentication-results: sourceware.org; auth=none
- References: <CAMQQO3knCrj=7dQNV1NEJofLhm7gZzvzG55K66uDOJt7qYrjGg at mail dot gmail dot com> <543FBDFF dot 3050709 at redhat dot com> <104DEFBD-D686-4290-8E3C-725A51C165E6 at dell dot com>
On 16/10/14 15:28, Paul_Koning@dell.com wrote:
> On Oct 16, 2014, at 8:45 AM, Phil Muldoon <pmuldoon@redhat.com> wrote:
>
>> On 16/10/14 11:45, Ãmer Sinan AÄacan wrote:
>>> Hi all,
>>>
>>> I'm putting some breakpoints and then running some actions when
>>> program reaches that points, using Python API.
>>>
>>> After a few breaks, GDB is starting to print these lines:
>>>
>>> Traceback (most recent call last):
>>> File "/home/omer/gdb_script/script.py", line 71, in handle_breakpoint
>>> self.breakpoint_jump_addrs[bp.location].add(addr)
>>> RuntimeError: maximum recursion depth exceeded
>> That's an error from Python. It tells me something in script.py is
>> not quite right. Impossible to tell without seeing script.py in
>> general. You can increase the recursion depth by doing something like
>>
>> import sys
>> sys.setrecursionlimit(9000)
>>
>> Where '9000' is a limit you can set and vary. However, this might
>> indeed be papering over the cracks, and not fixing the fault.
> I would expect that you could wrap the script in a try/except block, to catch the stack overflow and print a Python stack trace when that happens.
>
> Should GDB print a Python backtrace when the Python script fails, just as executing a Python script standalone would do?
It prints an abbreviated backtrace by default. "set python print-stack full" will enable the full backtrace (we had a request to do this for pretty printers).
Cheers
Phil