Problem using py-bt, py-locals, etc. during GDB debugging

Mark Shroyer mshroyer at awaredigital.com
Thu Dec 6 22:39:41 CET 2012


I'm having trouble with the py-bt, py-locals, etc. GDB commands (from
Python's python-gdb.py) while using GDB 7.4 to debug Python 2.7.3; I was
wondering if anyone here could offer advice.

Briefly, py-bt seems to identify the python stack frames correctly, but
shows "(unable to read python frame information)" for each, and likewise
py-locals fails with "Unable to read information on python frame".

The full GDB session is shown here:

https://gist.github.com/4228342#file_gdb_output.txt

My test script is as follows:

    from __future__ import print_function
    from os import kill, getpid
    from signal import SIGINT

    def factorial(n):
        if n == 0:
            # Break into GDB
            kill(getpid(), SIGINT)
            return 1
        else:
            return n * factorial(n-1)

    if __name__ == "__main__":
        n = 10
        print("factorial({0}) = {1}".format(n, factorial(n)))

And I'm seeing this with both the following sets of software:

 1. Ubuntu 12.04's python-dbg 2.7.3 and GDB 7.4 packages

 2. Freshly-built copies of GDB 7.5 and Python 2.7.3 (the latter built
    with -O0 -g3 in Ubuntu's GCC 4.6.3), after loading that Python's own
    copy of python-gdb.py into GDB.

Any ideas?  Thanks...
Mark




More information about the Python-list mailing list