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

Allows local variables to be watched (still a bit broken).

This commit is contained in:
FellippeHeitor 2021-07-27 00:28:03 -03:00
parent 426b26b002
commit a2a49cef01
4 changed files with 19 additions and 4 deletions

View file

@ -1,6 +1,6 @@
$CHECKING:OFF
DIM SHARED AS LONG vwatch_linenumber, vwatch_sublevel, vwatch_goto
DIM SHARED AS STRING vwatch_subname, vwatch_callstack
DIM SHARED AS STRING vwatch_subname, vwatch_internalsubname, vwatch_callstack
REDIM SHARED vwatch_breakpoints(0) AS _BYTE
REDIM SHARED vwatch_skiplines(0) AS _BYTE
'next lines are just to avoid "unused variable" warnings:
@ -10,5 +10,6 @@ vwatch_goto = 0
vwatch_breakpoints(0) = 0
vwatch_skiplines(0) = 0
vwatch_subname = ""
vwatch_internalsubname = ""
vwatch_callstack = ""
$CHECKING:ON

View file

@ -166,7 +166,7 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
cmd$ = cmd$ + MKL$(vwatch_linenumber)
GOSUB SendCommand
IF vwatch_sublevel > 1 THEN
cmd$ = "current sub:" + vwatch_subname$
cmd$ = "current sub:" + vwatch_internalsubname$
ELSE
cmd$ = "current sub:"
END IF
@ -226,6 +226,8 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
address = globalVariables + LEN(address) * localIndex
address = _MEMGET(m, address, _OFFSET)
GOSUB GetMemData
$CONSOLE
_ECHO "Sending global var: " + STR$(tempIndex) + " = " + result$
cmd$ = "global var:" + MKL$(tempIndex) + result$
GOSUB SendCommand
CASE "local var"
@ -234,10 +236,12 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET)
dataType$ = MID$(value$, 9)
address = localVariables + LEN(address) * localIndex
address = _MEMGET(m, address, _OFFSET)
GOSUB GetMemData
_ECHO "Sending local var: " + STR$(tempIndex) + " = " + result$
cmd$ = "local var:" + MKL$(tempIndex) + result$
GOSUB SendCommand
CASE "current sub"
cmd$ = "current sub:" + vwatch_subname$
cmd$ = "current sub:" + vwatch_internalsubname$
GOSUB SendCommand
CASE "set next line"
pauseMode = -1

View file

@ -6940,12 +6940,17 @@ SUB DebugMode
temp$ = MID$(temp$, 5)
IF usedVariableList(tempIndex&).watch THEN
cmd$ = ""
_ECHO "usedVariableList(tempIndex&).subfunc =" + usedVariableList(tempIndex&).subfunc
_ECHO "currentSub$ =" + currentSub$
IF LEN(usedVariableList(tempIndex&).subfunc) = 0 THEN
cmd$ = "global var:"
ELSEIF usedVariableList(tempIndex&).subfunc = currentSub$ THEN
cmd$ = "local var:"
END IF
IF LEN(cmd$) THEN
_CONSOLE ON
_ECHO "Requesting " + cmd$
_ECHO "currentSub$ = " + currentSub$
cmd$ = cmd$ + MKL$(tempIndex&) + MKL$(usedVariableList(tempIndex&).localIndex) + usedVariableList(tempIndex&).varType
GOSUB SendCommand
END IF
@ -6953,8 +6958,11 @@ SUB DebugMode
LOOP
END IF
CASE "global var", "local var"
_ECHO "Received " + cmd$
tempIndex& = CVL(LEFT$(value$, 4))
value$ = MID$(value$, 5)
_ECHO "index = " + STR$(tempIndex&)
_ECHO "=== value$ = " + value$
usedVariableList(tempIndex&).mostRecentValue = value$
CASE "current sub"
currentSub$ = value$

View file

@ -31,7 +31,7 @@ DIM SHARED vWatchNewVariable$, vWatchVariableExclusions$
vWatchErrorCall$ = "if (stop_program) {*__LONG_VWATCH_LINENUMBER=0; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);};if(new_error){bkp_new_error=new_error;new_error=0;*__LONG_VWATCH_LINENUMBER=-1; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);new_error=bkp_new_error;};"
vWatchVariableExclusions$ = "@__LONG_VWATCH_LINENUMBER@__LONG_VWATCH_SUBLEVEL@__LONG_VWATCH_GOTO@" + _
"@__STRING_VWATCH_SUBNAME@__STRING_VWATCH_CALLSTACK@__ARRAY_BYTE_VWATCH_BREAKPOINTS" + _
"@__ARRAY_BYTE_VWATCH_SKIPLINES@"
"@__ARRAY_BYTE_VWATCH_SKIPLINES@__STRING_VWATCH_INTERNALSUBNAME@"
DIM SHARED qb64prefix_set_recompileAttempts, qb64prefix_set_desiredState
DIM SHARED opex_recompileAttempts, opex_desiredState
@ -5158,6 +5158,8 @@ DO
PRINT #12, "qbs_set(__STRING_VWATCH_SUBNAME,qbs_new_txt_len(" + CHR$(34) + inclinenump$ + subfuncoriginalname$ + CHR$(34) + "," + str2$(LEN(inclinenump$ + subfuncoriginalname$)) + "));"
PRINT #12, "qbs_cleanup(qbs_tmp_base,0);"
PRINT #12, "qbs_set(__STRING_VWATCH_INTERNALSUBNAME,qbs_new_txt_len(" + CHR$(34) + subfunc + CHR$(34) + "," + str2$(LEN(subfunc)) + "));"
PRINT #12, "qbs_cleanup(qbs_tmp_base,0);"
PRINT #12, "*__LONG_VWATCH_LINENUMBER=-2; SUB_VWATCH((ptrszint*)vwatch_global_vars,(ptrszint*)vwatch_local_vars);"
END IF
END IF