[Stackless] Debugging stackless applications

Richard Tew richard.m.tew at gmail.com
Thu Aug 16 00:33:15 CEST 2007


On 8/15/07, Andrew Francis <andrewfr_ice at yahoo.com> wrote:
> >Anyone on the list care to step forward and write the
> >support needed :-)
>
> Where is the latest technical document on Stackless
> Python internals? I guess there is enough
> documentation on pdb out there.

I do not think it is that complex.  All you need to know is that the
debugging hooks are per-tasklet, rather than per-thread, and to either
adapt the existing standard library debugger to deal with it.  Or if
that is not feasible, write a new one.

All the Python frames, variables and so forth should be introspectable
whatever tasklet is active.  And you can get a long way with
introspection via dir() to find pretty much anything else you might
want.

e.g.

>>> import stackless
>>> def f(chan):
...     level1 = True
...     chan.receive()
...
>>> def g(chan):
...     level2 = True
...     f(chan)
...
>>> c = stackless.channel()
>>> t = stackless.tasklet(g)(c)
>>> t.blocked
False
>>> t.run()
>>> t.blocked
True
>>> t.frame.f_code.co_varnames
('chan', 'level1')
>>> t.frame.f_back.f_code.co_varnames
('chan', 'level2')
>>>

Cheers,
Richard.

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://stackless.com/cgi-bin/mailman/listinfo/stackless



More information about the Stackless mailing list