Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Python

evaluating code lines above breakpoints ?

 
Jump to:  
 
Stef Mientki
PostPosted: Wed Aug 20, 2008 4:37 pm    Post subject: evaluating code lines above breakpoints ?
       
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 ?

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

thanks,
Stef Mientki
 

 
Diez B. Roggisch
PostPosted: Thu Aug 21, 2008 8:09 am    Post subject: Re: evaluating code lines above breakpoints ?
       
Stef Mientki wrote:

Quote:
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.

Quote:
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
 

 
Stef Mientki
PostPosted: Thu Aug 21, 2008 6:31 pm    Post subject: Re: evaluating code lines above breakpoints ?
       
Diez B. Roggisch wrote:
Quote:
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
Quote:


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
--
LINK
 

 
Tim Roberts
PostPosted: Fri Aug 22, 2008 4:32 am    Post subject: Re: evaluating code lines above breakpoints ?
       
Stef Mientki <stef.mientki@gmail.com> wrote:

Quote:
Diez B. Roggisch wrote:

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.

Most Python functions do not have a large set of locals().
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

przewóz chorych wyniki na żywo Lechoń Jan wiersze spadki certyfikat energetyczny