How to get the python sourcecode line, when debuging the Python C sources?

Mark Hammond MHammond at skippinet.com.au
Tue Sep 7 20:29:27 EDT 1999


Stefan Knappmann <101.139915 at germanynet.de> wrote in message

>Does anybody know in which C variable I can find the Python Stack?
>Or how to get the activ Python source code line from within the C
>debugger?

Move down the stack to eval2() in ceval.c.  f->f_lineno will tell you the
line number.  f->f_code->co_filename + 20 bytes is the start of the ASCII
string containing the filename.  Adding something like "(char *)(((char
*)f->f_code->co_filename))+20)" to the watch window should do the trick.

Mark.







More information about the Python-list mailing list