Re: recursion limit exceeded in Python API, but there's only one function in traceback

Ömer Sinan Ağacan <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAMQQO3mfg3Q9ij14XJ=y4m_+beh8bsc9CbcfPiGfUOtgz530HQ@mail.gmail.com>
2014-10-16 18:03 GMT+03:00  <[email protected]>:
> Is that the handler for a breakpoint?  Does the completion of the “si” command invoke the breakpoint handler?  If yes, that’s your answer.
>
>         paul

Interesting, but I don't think that's causing the problem. I changed
the script to:

  import gdb
  import traceback

  def handler(ev):
      try:
          print "handling a stop"
          gdb.execute("stepi")
          gdb.execute("continue")
      except:
          traceback.print_stack()

  gdb.events.stop.connect(handler)

When I first attach to the process, I'm getting:

  [..snip..]
  handling a stop
  0x080eecea in UpdateInput() ()
  handling a stop
  0x080eecef in UpdateInput() ()
  handling a stop
  0x080eece0 in UpdateInput() ()
  handling a stop
  0x080eece7 in UpdateInput() ()
  Traceback (most recent call last):
    File "/home/omer/gdb_script/stackoverflow.py", line 10, in handler
      traceback.print_stack()
    File "/usr/lib64/python2.7/traceback.py", line 269, in print_stack
      print_list(extract_stack(f, limit), file)
    File "/usr/lib64/python2.7/traceback.py", line 304, in extract_stack
      linecache.checkcache(filename)
  RuntimeError: maximum recursion depth exceeded

Again a weird "recursion error" with just 3 stack frames.

When I ignore and continue with `c`, it's failing with this:

  [.. snip ..]
  File "/home/omer/gdb_script/stackoverflow.py", line 7, in handler
    gdb.execute("stepi")
  File "/home/omer/gdb_script/stackoverflow.py", line 7, in handler
    gdb.execute("stepi")
  File "/home/omer/gdb_script/stackoverflow.py", line 10, in handler
    traceback.print_stack()
  File "/home/omer/gdb_script/stackoverflow.py", line 7, in handler
    gdb.execute("stepi")
  [.. snip ..]

There are thousands of same lines like this.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.