saving Python process state for later debugging

yossi.kreinin at gmail.com yossi.kreinin at gmail.com
Sun Apr 1 11:41:04 EDT 2007


On Apr 1, 2:57 pm, "aspineux" wrote:
>
> A context in python is no more than 2 dictionaries ( globals() and
> locals()).
> You can easily serialize both to store them.

I don't think it will work with objects defined by extension modules,
except if they somehow support serialization, will it? I guess I can
dump core for debugging these objects, and serialize the Python
context for debugging the rest. Finding the extension objects in the
core dump can be a pain though, as will be figuring out the stack with
interlaced Python & native code. And then there are the lovely cases
when CPython crashes, like "deletion of interned string failed. Abort
(core dumped)", where you get to shovel through CPython state with a
native debugger.

The thing with mixing native code with Python is that when native code
misbehaves, it's a big problem, and if Python code misbehaves, it's
still a problem, although a smaller one (serializing the native state
& navigating through it). Maybe the best way around this is to spawn
sub-processes for running native code...




More information about the Python-list mailing list