MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / GetScriptStack

Function GetScriptStack

source/Debugger.cpp:2903–2927  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2901
2902
2903void GetScriptStack(LPTSTR aBuf, int aBufSize, DbgStack::Entry *aTop)
2904{
2905 aBufSize -= 12;
2906 auto aBuf_orig = aBuf;
2907 for (auto se = aTop ? aTop : g_Debugger.mStack.mTop - 1; se >= g_Debugger.mStack.mBottom; --se)
2908 {
2909 auto &line = *se->line;
2910 auto line_start = aBuf;
2911 if (se->type == DbgStack::SE_Thread)
2912 aBuf += sntprintf(aBuf, BUF_SPACE_REMAINING, _T("> %s\r\n"), se->desc);
2913 else
2914 {
2915 aBuf += sntprintf(aBuf, BUF_SPACE_REMAINING, _T("%s (%i) : [%s] ")
2916 , Line::sSourceFile[line.mFileIndex], (int)line.mLineNumber, se->Name());
2917 aBuf = line.ToText(aBuf, BUF_SPACE_REMAINING, true, 0, false, false);
2918 }
2919 if (BUF_SPACE_REMAINING <= 1) // In case of truncation, there should be 1 char left, since the terminator is not counted.
2920 {
2921 aBuf = line_start;
2922 aBufSize += 12;
2923 sntprintf(aBuf, BUF_SPACE_REMAINING, _T("... %i more"), int(se - g_Debugger.mStack.mBottom) + 1);
2924 break;
2925 }
2926 }
2927}
2928
2929
2930#endif

Callers 1

Error__NewMethod · 0.85

Calls 3

sntprintfFunction · 0.85
NameMethod · 0.45
ToTextMethod · 0.45

Tested by

no test coverage detected