Jump to content

Can I run a stacktrace in AutoIt? How?


Penny
 Share

Recommended Posts

http://msdn.microsoft.com/en-us/library/system.diagnostics.stacktrace.aspx

I used these in C# to find out exactly where and why I was having a problem. The code I used (RunUO, in case anyone knows...) basically stacktraced if the script crashed, telling you the lines and successive calls that took you to crashing. for instance

called Init() on line 5
called ThisWillEventuallyCrashIt() on line 112
called ThisWillCrashIt() on line 321
div/0 on line 342

I hope someone understood what I want to do :D

Edit: For instance, this is the code I use to handle the errors myself

Func ErrorLog($msg)
    _FileWriteLog(@ScriptDir & "\error.log", $msg)
EndFunc

Func ErrorHandling()
    ConsoleWrite(@CRLF & '-- Handled Error: "' & $ErrorHandler.Description & '"')
    
    Dim $h = Hex($ErrorHandler.Number, 8)
    
    Dim $strMsg = "Error Number: 0x" & $h & @CRLF
    $strMsg &= "Description: " & $ErrorHandler.Description & @CRLF
    $strMsg &= "Script Line: " & $ErrorHandler.ScriptLine & @CRLF
    
    If $Script_DebugMode Then       
        ConsoleWrite(@CRLF & $strMsg)
    EndIf
    
    ErrorLog("0x" & $h & ": " & $ErrorHandler.Description)
    
    SetError(1)
    
    If $Script_onerror_Exit Then
        MsgBox(4096,"Critical Error",$strMsg & @CRLF & @CRLF & "Application terminated.")
        Exit
    EndIf
EndFunc

how would I add some beatiful StackTraces to that? is it even possible? =(

Thanks!!

Edited by Penny
Link to comment
Share on other sites

You will need to have the full version of SciTE4AtutoIt3:

http://www.autoitscript.com/autoit3/scite/downloads.shtml

"Lite" version that comes with the regular AutoIt install

Posted Image

full version

Posted Image

Yeah I had the lite version...

..wow, that way of tracing errors (commenting absolutely every function) is rather untraditional (specially since I had a timer flying around, haha) but it got me there, so.. Thank you very much :D

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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