Jump to content

Recommended Posts

Posted (edited)

Hi,

Just want to propose some changes for AutoIt to allow easier script

debugging. There has been a lot of talk in other topics about the need

for debugging features.

The changes detailed below are a trace output and a DebugPrint() function.

Both of these use the win32 OutputDebugString() to spit messages to a

debugger - either Visual Studio, or DebugView from www.sysinternals.com.

DebugView can log the debug output to a file and perform remote debugging.

Trace output is enabled with AutoItSetOption('DebugOutputEnabled',1)

Debug output is generated with DebugPrint($my_var)

Output looks something like:

test.au3: Line 029: TestFunc2(20)

test.au3: Line 044: MsgBox(0, "AutoIt Example", "Inside TestFunc2() - $var is: " & $var)

test.au3: Line 045: DebugPrint($var)

20

test.au3: Line 046: EndFunc

Files attached to the post have the test executable, source, test script and output.

Based on sources autoit-v3.1.0-src.exe

Feedback appreciated.

Cheers, Matt_J

Edit: Removed code for readability

AU3_Matt_J_2005_03_05.zip

Edited by Matt_J

Taken a Turing test lately?

Posted

  Matt_J said:

...

Output looks something like:

test.au3: Line 029: TestFunc2(20)

test.au3: Line 044: MsgBox(0, "AutoIt Example", "Inside TestFunc2() - $var is: " & $var)

test.au3: Line 045: DebugPrint($var)

20

test.au3: Line 046: EndFunc

...

Woot!

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Posted

With trace, would expanded variables ever be an option with trace? So you can see how the interpreter see the script, like in it's runtime condition? Instead of seeing $var, can we see expanded 'Hello variable contents'. Is this an option for debugging with trace?

:lmao:

Posted (edited)

Just put something together that loops through the tokens after the lexer() call and spits the variable values one per line.

Options are AutoItSetOption('EnableDebugOutput',n) where n=0 no output, n=1 trace output, n=2 trace output with values.

Changes are in attached file.

Output looks like:

test.au3: Line 029: TestFunc2(20)

test.au3: Line 044: MsgBox(0, "AutoIt Example", "Inside TestFunc2() - $var is: " & $var)

test.au3: Line 044: TRACE $var=20

test.au3: Line 045: DebugPrint($var)

test.au3: Line 045: TRACE $var=20

20

test.au3: Line 046: EndFunc

Edit: Doesn't work for arrays. There is a whole problem of understanding syntax here for in-place expansion

(which side of a variable assignment, function calls, array index etc... too hard basket).

Can I suggest just using the DebugPrint() to spit variable values? :lmao:

AU3_Matt_J_2005_03_06.zip

Edited by Matt_J

Taken a Turing test lately?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...