Diez B. Roggisch wrote:
Stef Mientki wrote:

hello,

I'm trying to create a high level debugger, based on rpd2.

So when the debugger enters a breakpoint,
I want to display the values of all variables in the, let's say,
5 lines above the breakpoint (if possible).
Any hints on how I get a list of all vars in those lines ?
My rough idea is to scan the lines, skip keywords, test type of each
term ( by eval), if the term is var eval the value of it.
Are there better ways ?

I don't know about better ways, but I for *sure* know that this is a really
bad idea. Simply because a debugger that executes arbitrary evals can cause
side-effects that make it useless. Why do you want this anyway? Why don't you simply show all the variables in
the local frame? I'd say thats enough.
because it's too much data, and too much data decreases information content.
I'ld like a simple MatLab like environment,
more like putting print-statements in between the code,
so no complex Python things (so probably / hopefully also no side effects).

For complex Python, I'll build in the option to launch an external winPDB
so all details are fully available.

Thanks for pointing me on the possible side effects.

cheers,
Stef
Another idea, when hoovering over a variable during a breakpoint, a
hint appears with the type and value of that var.

The simple thing to do is to extract tokens, and then if these as names are
matched in the local frames, you can display the content.

Things get more difficult in cases like

foo[index]

as this can cause a side-effect to occur. I wouldn't automatically evaluate
the expression, for reasons given above.

Diez
--
http://mail.python.org/mailman/listinfo/python-list

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to