1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 15:00:38 +00:00

Sends call stack to IDE when an error occurs.

This commit is contained in:
FellippeHeitor 2021-07-19 22:25:15 -03:00
parent d1249d25d5
commit 655f1e3b19
2 changed files with 16 additions and 9 deletions

View file

@ -6428,6 +6428,7 @@ SUB DebugMode
cmd$ = "call stack" cmd$ = "call stack"
GOSUB SendCommand GOSUB SendCommand
IF BypassRequestCallStack THEN GOTO ShowCallStack
dummy = DarkenFGBG(0) dummy = DarkenFGBG(0)
clearStatusWindow 0 clearStatusWindow 0
setStatusMessage 1, "Requesting call stack...", 7 setStatusMessage 1, "Requesting call stack...", 7
@ -6443,6 +6444,7 @@ SUB DebugMode
IF cmd$ = "call stack" THEN IF cmd$ = "call stack" THEN
'display call stack 'display call stack
callstacklist$ = value$ callstacklist$ = value$
ShowCallStack:
retval = idecallstackbox retval = idecallstackbox
PCOPY 3, 0: SCREEN , , 3, 0 PCOPY 3, 0: SCREEN , , 3, 0
clearStatusWindow 0 clearStatusWindow 0
@ -6510,6 +6512,7 @@ SUB DebugMode
SELECT CASE cmd$ SELECT CASE cmd$
CASE "breakpoint", "line number" CASE "breakpoint", "line number"
BypassRequestCallStack = 0
l = CVL(value$) l = CVL(value$)
idecy = l idecy = l
debugnextline = l debugnextline = l
@ -6542,10 +6545,12 @@ SUB DebugMode
clearStatusWindow 1 clearStatusWindow 1
COLOR , 4 COLOR , 4
setStatusMessage 1, "Error occurred on line" + STR$(l), 13 setStatusMessage 1, "Error occurred on line" + STR$(l), 13
BypassRequestCallStack = -1
PauseMode = -1 PauseMode = -1
CASE "call stack size" CASE "call stack size"
'call stack is only received without having been 'call stack is only received without having been
'requested when the program is about to quit 'requested when the program is about to quit or
'when an error just occurred
callStackLength = CVL(value$) callStackLength = CVL(value$)
start! = TIMER start! = TIMER
DO DO

View file

@ -65,10 +65,7 @@ SUB vwatch (localVariables AS _OFFSET)
END IF END IF
IF vwatch_linenumber = 0 THEN IF vwatch_linenumber = 0 THEN
cmd$ = "call stack size:" + MKL$(callStackLength) GOSUB SendCallStack
GOSUB SendCommand
cmd$ = "call stack:" + vwatch_callstack
GOSUB SendCommand
cmd$ = "quit:Program ended." cmd$ = "quit:Program ended."
GOSUB SendCommand GOSUB SendCommand
CLOSE #ide CLOSE #ide
@ -77,6 +74,7 @@ SUB vwatch (localVariables AS _OFFSET)
EXIT SUB EXIT SUB
ELSEIF vwatch_linenumber = -1 THEN ELSEIF vwatch_linenumber = -1 THEN
'report an error in the most recent line 'report an error in the most recent line
GOSUB SendCallStack
cmd$ = "error:" + MKL$(lastLine) cmd$ = "error:" + MKL$(lastLine)
GOSUB SendCommand GOSUB SendCommand
EXIT SUB EXIT SUB
@ -168,10 +166,7 @@ SUB vwatch (localVariables AS _OFFSET)
REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE
CASE "call stack" CASE "call stack"
'send call stack history" 'send call stack history"
cmd$ = "call stack size:" + MKL$(callStackLength) GOSUB SendCallStack
GOSUB SendCommand
cmd$ = "call stack:" + vwatch_callstack
GOSUB SendCommand
CASE "local" CASE "local"
i = CVL(value$) i = CVL(value$)
address = localVariables + LEN(address) * i address = localVariables + LEN(address) * i
@ -217,6 +212,13 @@ SUB vwatch (localVariables AS _OFFSET)
END IF END IF
RETURN RETURN
SendCallStack:
cmd$ = "call stack size:" + MKL$(callStackLength)
GOSUB SendCommand
cmd$ = "call stack:" + vwatch_callstack
GOSUB SendCommand
RETURN
SendCommand: SendCommand:
cmd$ = cmd$ + endc$ cmd$ = cmd$ + endc$
PUT #ide, , cmd$ PUT #ide, , cmd$