AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Show value of variables for debugging

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
keyboardfreak



Joined: 09 Oct 2004
Posts: 126
Location: Budapest, Hungary

PostPosted: Sat Jan 12, 2008 9:06 am    Post subject: Show value of variables for debugging Reply with quote

It would help debugging a great deal if the "lines recently executed window" showed the value variables too. Perhaps optionally.


For example, when I see

if (a < b)


then I'd also like to see the values of variables there at that point (not later, so the "variables view" is not good for this).

For long strings it could show the first 20 characters or so.

What do you think?
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2494
Location: Australia, Qld

PostPosted: Sat Jan 12, 2008 2:09 pm    Post subject: Reply with quote

This would hurt performance. Currently only a pointer to each Line is stored after it executes, in a fixed size array. The text you see is generated when you view/refresh "lines recently executed."

Note that for expressions, you can use the multi-statement operator (comma) to call a function on the same line:
Code:
if (a < b), log("a < b :: " a " < " b)
log() will be called while the expression is being evaluated, regardless of the outcome.


A step-through debugging capability would perform faster and with less memory usage. IMO, it would also be more useful.
Planned Features wrote:
Debugger: Have a line-by-line execution mode so that script will pause automatically after every line.

http://www.autohotkey.com/changelog/PendingChanges.htm

For now you'll have to settle for ListVars/ListLines & Pause. Crying or Very sad
Back to top
View user's profile Send private message
keyboardfreak



Joined: 09 Oct 2004
Posts: 126
Location: Budapest, Hungary

PostPosted: Sat Jan 12, 2008 4:15 pm    Post subject: Reply with quote

lexikos wrote:
This would hurt performance. Currently only a pointer to each Line is stored after it executes, in a fixed size array. The text you see is generated when you view/refresh "lines recently executed."


Okay, then there should be an execution option to generate these lines during running. This wouldn't hurt performance, since I only toggled it if there was a problem.

lexikos wrote:
Note that for expressions, you can use the multi-statement operator (comma) to call a function on the same line"


Yep, but the point is I shouldn't have to modify the code manually in order to trace what's happening.

lexikos wrote:
A step-through debugging capability would perform faster and with less memory usage. IMO, it would also be more useful."


Debugging capability is useful, but simple logging of execution is enough in most of the cases in my experience and it may be simpler to implement.
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2494
Location: Australia, Qld

PostPosted: Sat Jan 12, 2008 5:05 pm    Post subject: Reply with quote

Quote:
... simple logging of execution ... may be simpler to implement.
A step-through debugger could be as simple as a Pause after every line executed, if some flag (or as you say, "execution option") is set.
keyboardfreak wrote:
Okay, then there should be an execution option to generate these lines during running. This wouldn't hurt performance, since I only toggled it if there was a problem.
Chris wrote:
One reason I've been procrastinating the line-stepping feature is that it would probably impact performance slightly, since a critical section of the code would have to be modified to check some step-mode flag, or whether an "every-line timer" is in effect.
From Planned Features (thread), back in 2004. Sad
Back to top
View user's profile Send private message
keyboardfreak



Joined: 09 Oct 2004
Posts: 126
Location: Budapest, Hungary

PostPosted: Sat Jan 12, 2008 5:18 pm    Post subject: Reply with quote

Chris wrote:
One reason I've been procrastinating the line-stepping feature is that it would probably impact performance slightly, since a critical section of the code would have to be modified to check some step-mode flag, or whether an "every-line timer" is in effect.


Okay, then there could be two AH exes. One normal and one debug. This flag wouldn't be compiled in the normal one, so it wouldn't hurt performance a bit, and those who want line-by-line logging could use the debug version.

lexikos wrote:
From Planned Features (thread), back in 2004. Sad


Judging from the date this feature won't be implemented overnight. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group