[Python-Dev] Interactive Debugging of Python
Christian Tismer
tismer at appliedbiometrics.com
Fri May 21 09:12:05 CEST 1999
Mark Hammond wrote:
>
> > I'm writing a prototype of a stackless Python, which means that
> > you will be able to access the current state of the interpreter
> > completely.
> > The inner interpreter loop will be isolated from the frame
> > dispatcher. It will break whenever the ticker goes zero.
> > If you set the ticker to one, you will be able to single
> > step on every opcode, have the value stack, the frame chain,
> > everything.
>
> I think the main point is how to change code when a Python frame already
> references it. I dont think the structure of the frames is as important as
> the general concept. But while we were talking frame-fiddling it seemed a
> good point to try and hijack it a little :-)
>
> Would it be possible to recompile just a block of code (eg, just the
> current function or method) and patch it back in such a way that the
> current frame continues execution of the new code?
Sure. Since the frame holds a pointer to the code, and the current
IP and SP, your code can easily change it (with care, or GPF:) .
It could even create a fresh code object and let it run only
for the running instance. By instance, I mean a frame which is
running a code object.
> I feel this is somewhat related to the inability to change class
> implementation for an existing instance. I know there have been hacks
> around this before but they arent completly reliable and IMO it would be
> nice if the core Python made it easier to change already running code -
> whether that code is in an existing stack frame, or just in an already
> created instance, it is very difficult to do.
I think this has been difficult, only since information was hiding
in the inner interpreter loop. Gonna change now.
ciao - chris
--
Christian Tismer :^) <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
10553 Berlin : PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
we're tired of banana software - shipped green, ripens at home
More information about the Python-Dev
mailing list