[Stackless] Debugging stackless applications

Christian Tismer tismer at stackless.com
Fri Aug 17 03:50:38 CEST 2007


Hi,

On Aug 16, 2007, at 8:43 PM, Andrew Francis wrote:

> Hi Richard:
>
>> 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.
>
> Since I know very little about debuggers, Python, and
> Stackless Python internals, so I will assume writing a
> debugger is complex. Right now I am going through the
> "Continuations and Stackless Python" slides. Also I
> need to read up more on pdb.

Definately, yes.
But it is as Richard said.
Stackless is not that different. It is just multiple.
Current debuggers are not aware of switched
contexts. That's little to add, in principle.

> What you described is only a piece of puzzle. I am
> interested in stuff like concerning how to inspect
> Stackless Python objects?
>
> - How do I control the frame list (the structure in
> lieu of the C stack)?

This is an addition which "normal" debuggers do not
provide, ether.

> - What is the instruction pointer(s) (or its
> equivalent)?

This is easy inspection of the current frame. May or may
not be supported by current debuggers, simple to do.

> - How do I get the list of tasklets?

Unnecessary overhead. This is an excercize for
the reader: Subclass tasklets to give a list of all
tasklets. Hint: weak references are useful.

> - what is on the runnable list? What is blocked?
> - what are the state of the channels?
>
> All this means diving into Stackless Python's
> internals.

I think these are all nice, simple things, but they go
a bit beyond what is expected from normal debuggers,
either. I agree that it's nice to have as much as possible.

At the same time, I'm reluctant to fix the implementation
too much in stone.

As you know, I'm considering new approaches, new data structures,
and different, cooperative paradigms in parallel. Stackless as it
is should be seen as one way to implement things, and one
way to think of things. But this is all too special, and I regret
to add new features at the C level if it can be avoided.

I think that debugging, as well as all new ideas and features,
will be implemented in Stackless PyPy. This is in progress
and very promising. I will start documenting these things
when the new TRAC system is online.

Stackless PyPy is ideal for debugging, since it does not depend
on C. You can just add code to see what happens.
Even without PyPy, there is an almost complete greenlet-based
stackless implementation that runs on unmodified CPython.
Using these for debugging will probably be the simplest
and most flexible approaches.

I will take care of these after PyCon UK, Sept 8-9.

cheers - chris
--
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20070817/3c4ed25b/attachment.htm>
-------------- next part --------------
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://stackless.com/cgi-bin/mailman/listinfo/stackless


More information about the Stackless mailing list