Is it possible to use GDB's reverse debugging with Python? How?

0 votes
asked Sep 27, 2010 by daniel-gasull

I am trying to use GDB's reverse debugging with a Django application. I get it running in GDB, but I can't make it run backwards.

I stopped my Django app with Ctrl-Z and then entered reverse-next at the gdb prompt, getting the error message "Target multi-thread does not support this command."

Am I doing it wrong? Isn't this possible? Both?

2 Answers

0 votes
answered Sep 27, 2010 by chiggsy

That's an amazingly good question.

My first impulse would be to ensure I was using IPython as my shell for django and see if it's pdb support would help in this case. Pdb should have a very similar interface to gdb. As I recall, gdb is what's used to debug C/C++ programs, while django is being executed by a python interpreter. Using Pdb is here:

http://ericholscher.com/blog/2008/aug/31/using-pdb-python-debugger-django-debugging-series-/

Also you might want to try using django-extensions, for access to the werkzeug debugging view.

0 votes
answered Sep 29, 2010 by employed-russian

Before you can use GDB for reverse debugging, you must tell it to record your program execution (so it can play it back) via target record command, as documented here.

I am not sure this will help you debug your Django application though -- GDB is well suited for debugging "native" code (compiled C/C++), and is not well suited for debugging "interpreted" code (in either forward or reverse direction).

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...