1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 11:40:38 +00:00

Watches INTEGER, UINTEGER, LONG, ULONG, SINGLE, DOUBLE variables.

Only in the main module for now.
This commit is contained in:
FellippeHeitor 2021-07-26 23:56:48 -03:00
parent c0b445789f
commit 426b26b002
2 changed files with 20 additions and 11 deletions

View file

@ -7,6 +7,7 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
STATIC buffer$, endc$ STATIC buffer$, endc$
DIM AS LONG i, tempIndex, localIndex DIM AS LONG i, tempIndex, localIndex
DIM AS _OFFSET address DIM AS _OFFSET address
DIM AS _MEM m
DIM start!, temp$, cmd$, value$, k&, dataType$, result$ DIM start!, temp$, cmd$, value$, k&, dataType$, result$
DECLARE LIBRARY DECLARE LIBRARY
@ -164,6 +165,12 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
IF vwatch_breakpoints(vwatch_linenumber) THEN cmd$ = "breakpoint:" IF vwatch_breakpoints(vwatch_linenumber) THEN cmd$ = "breakpoint:"
cmd$ = cmd$ + MKL$(vwatch_linenumber) cmd$ = cmd$ + MKL$(vwatch_linenumber)
GOSUB SendCommand GOSUB SendCommand
IF vwatch_sublevel > 1 THEN
cmd$ = "current sub:" + vwatch_subname$
ELSE
cmd$ = "current sub:"
END IF
GOSUB SendCommand
DO 'main loop DO 'main loop
SELECT CASE cmd$ SELECT CASE cmd$
@ -217,10 +224,8 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
localIndex = CVL(MID$(value$, 5, 4)) localIndex = CVL(MID$(value$, 5, 4))
dataType$ = MID$(value$, 9) dataType$ = MID$(value$, 9)
address = globalVariables + LEN(address) * localIndex address = globalVariables + LEN(address) * localIndex
address = _MEMGET(m, address, _OFFSET)
GOSUB GetMemData GOSUB GetMemData
$CONSOLE
_ECHO "global var requested:" + STR$(tempIndex) + STR$(localIndex) + " " + dataType$
_ECHO "== result = " + result$
cmd$ = "global var:" + MKL$(tempIndex) + result$ cmd$ = "global var:" + MKL$(tempIndex) + result$
GOSUB SendCommand GOSUB SendCommand
CASE "local var" CASE "local var"
@ -228,13 +233,11 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
localIndex = CVL(MID$(value$, 5, 4)) localIndex = CVL(MID$(value$, 5, 4))
dataType$ = MID$(value$, 9) dataType$ = MID$(value$, 9)
address = localVariables + LEN(address) * localIndex address = localVariables + LEN(address) * localIndex
GOSUB GetMemData address = _MEMGET(m, address, _OFFSET)
_ECHO "local var requested:" + STR$(tempIndex) + STR$(localIndex) + " " + dataType$
_ECHO "== result = " + result$
cmd$ = "local var:" + MKL$(tempIndex) + result$ cmd$ = "local var:" + MKL$(tempIndex) + result$
GOSUB SendCommand GOSUB SendCommand
CASE "current sub" CASE "current sub"
cmd$ = "current sub:" + vwatch_subname cmd$ = "current sub:" + vwatch_subname$
GOSUB SendCommand GOSUB SendCommand
CASE "set next line" CASE "set next line"
pauseMode = -1 pauseMode = -1
@ -306,7 +309,7 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
DIM integerType AS INTEGER, uintegerType AS _UNSIGNED INTEGER DIM integerType AS INTEGER, uintegerType AS _UNSIGNED INTEGER
DIM longType AS LONG, ulongType AS _UNSIGNED LONG DIM longType AS LONG, ulongType AS _UNSIGNED LONG
DIM singleType AS SINGLE, doubleType AS DOUBLE DIM singleType AS SINGLE, doubleType AS DOUBLE
DIM varOffset AS _OFFSET, m AS _MEM, m2 AS _MEM DIM varOffset AS _OFFSET, m2 AS _MEM
SELECT CASE dataType$ SELECT CASE dataType$
CASE "INTEGER" CASE "INTEGER"

View file

@ -6273,6 +6273,7 @@ SUB DebugMode
STATIC client& STATIC client&
STATIC buffer$ STATIC buffer$
STATIC endc$ STATIC endc$
STATIC currentSub$
timeout = 10 timeout = 10
_KEYCLEAR _KEYCLEAR
@ -6938,13 +6939,16 @@ SUB DebugMode
tempIndex& = CVL(LEFT$(temp$, 4)) tempIndex& = CVL(LEFT$(temp$, 4))
temp$ = MID$(temp$, 5) temp$ = MID$(temp$, 5)
IF usedVariableList(tempIndex&).watch THEN IF usedVariableList(tempIndex&).watch THEN
cmd$ = ""
IF LEN(usedVariableList(tempIndex&).subfunc) = 0 THEN IF LEN(usedVariableList(tempIndex&).subfunc) = 0 THEN
cmd$ = "global var:" cmd$ = "global var:"
ELSE ELSEIF usedVariableList(tempIndex&).subfunc = currentSub$ THEN
cmd$ = "local var:" cmd$ = "local var:"
END IF END IF
cmd$ = cmd$ + MKL$(tempIndex&) + MKL$(usedVariableList(tempIndex&).localIndex) + usedVariableList(tempIndex&).varType IF LEN(cmd$) THEN
GOSUB SendCommand cmd$ = cmd$ + MKL$(tempIndex&) + MKL$(usedVariableList(tempIndex&).localIndex) + usedVariableList(tempIndex&).varType
GOSUB SendCommand
END IF
END IF END IF
LOOP LOOP
END IF END IF
@ -6952,6 +6956,8 @@ SUB DebugMode
tempIndex& = CVL(LEFT$(value$, 4)) tempIndex& = CVL(LEFT$(value$, 4))
value$ = MID$(value$, 5) value$ = MID$(value$, 5)
usedVariableList(tempIndex&).mostRecentValue = value$ usedVariableList(tempIndex&).mostRecentValue = value$
CASE "current sub"
currentSub$ = value$
CASE "quit" CASE "quit"
CLOSE #client& CLOSE #client&
dummy = DarkenFGBG(0) dummy = DarkenFGBG(0)