473,503 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Aug 20 '08 #1
3 1051
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.
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
Aug 21 '08 #2
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
Aug 21 '08 #3
Stef Mientki <st**********@gmail.comwrote:
>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, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 22 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1808
by: Michael L. Labbe | last post by:
Hello. I'm an experienced programmer who is evaluating learning Python if it is applicable to a few projects. The programs I am going to list are production software - they are not throwaway toy...
0
1254
by: Charles Law | last post by:
I have started getting "There is no source code available for the current location" when I run my VB.NET solution. I have no breakpoints set but cannot get rid of this message. The debugger...
4
15906
by: Ray | last post by:
I have an application that is suddenly having some very strange problems. If I step through the following code; With AppSetting conRules.ConnectionString = "Data Source=" & .Svr & ";Initial...
3
4097
by: Kevin Rollo | last post by:
I'm playing with a generic routine to export data, the concept is to have a list of data driven templates defining what fields to output. Evaluating a simple variable field name in the function...
2
1261
by: mclagett | last post by:
Can anyone please help me figure out why all of a sudden (even after many restarts of Visual Studio 2005 and reboots, etc) I am no longer able to set breakpoints in the disassembler window. I...
30
2454
by: jeremygetsmail | last post by:
I've got an adp (Metrix.adp) with a reference to another adp (InteractSQL.adp). InteractSQL sits on a server, and is refered to by all of the clients (Metrix), which sit on the client machines...
9
4894
by: Rea | last post by:
Hi eb I set some 'Stop' statements and also visual breakpoints in asp code (vbscript). I am doing that in Microsoft Script debugger. Than I refresh the original page and expect execution to halt...
2
4202
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
19
3776
by: Pavan | last post by:
Hi, I want to know if there is any software for measuring lines of code of my c++ application. I found out a tool, sloccount, but it gives only physical lines of code. I found out one more...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.