Created
November 27, 2013 07:45
-
-
Save hoppfrosch/7672038 to your computer and use it in GitHub Desktop.
Get the current AHK-callstack #ahk #script #function #debug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CallStack(deepness = 5, printLines = 1) | |
{ | |
loop % deepness | |
{ | |
lvl := -1 - deepness + A_Index | |
oEx := Exception("", lvl) | |
oExPrev := Exception("", lvl - 1) | |
FileReadLine, line, % oEx.file, % oEx.line | |
if(oEx.What = lvl) | |
continue | |
stack .= (stack ? "`n" : "") "File '" oEx.file "', Line " oEx.line (oExPrev.What = lvl-1 ? "" : ", in " oExPrev.What) (printLines ? ":`n" line : "") "`n" | |
} | |
return stack | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo1() | |
return | |
foo1() | |
{ | |
foo2() | |
} | |
foo2() | |
{ | |
foo3() | |
} | |
foo3() | |
{ | |
foo4() | |
} | |
foo4() | |
{ | |
foo5() | |
} | |
foo5() | |
{ | |
foo6() | |
} | |
foo6() | |
{ | |
foo7() | |
} | |
foo7() | |
{ | |
throw Exception( "`n" CallStack() ) | |
} | |
FileReadLine( file, line ) | |
{ | |
FileReadLine, data,% file,% line | |
return data | |
} | |
#include CallStack.ahk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment