mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-01 15:00:38 +00:00
Initial implementation of call stack ($DEBUG).
This commit is contained in:
parent
c59cef04d7
commit
8d35b87fd1
|
@ -6315,6 +6315,11 @@ SUB DebugMode
|
||||||
COLOR , 4
|
COLOR , 4
|
||||||
setStatusMessage 1, "Error occurred on line" + STR$(l), 13
|
setStatusMessage 1, "Error occurred on line" + STR$(l), 13
|
||||||
PauseMode = -1
|
PauseMode = -1
|
||||||
|
CASE "call"
|
||||||
|
callstack = callstack + 1
|
||||||
|
onLine$ = STR$(CVL(RIGHT$(value$, 4)))
|
||||||
|
procedure$ = LEFT$(value$, LEN(value$) - 4)
|
||||||
|
'store this in an array and allow it to be inspected
|
||||||
END SELECT
|
END SELECT
|
||||||
|
|
||||||
_LIMIT 100
|
_LIMIT 100
|
||||||
|
|
|
@ -4761,6 +4761,7 @@ DO
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
subfunc = RTRIM$(id.callname) 'SUB_..."
|
subfunc = RTRIM$(id.callname) 'SUB_..."
|
||||||
|
subfuncoriginalname$ = RTRIM$(id.cn)
|
||||||
subfuncn = subfuncn + 1
|
subfuncn = subfuncn + 1
|
||||||
closedsubfunc = 0
|
closedsubfunc = 0
|
||||||
subfuncid = targetid
|
subfuncid = targetid
|
||||||
|
@ -5122,9 +5123,6 @@ DO
|
||||||
PRINT #12, "uint8 *tmp_mem_static_pointer=mem_static_pointer;"
|
PRINT #12, "uint8 *tmp_mem_static_pointer=mem_static_pointer;"
|
||||||
PRINT #12, "uint32 tmp_cmem_sp=cmem_sp;"
|
PRINT #12, "uint32 tmp_cmem_sp=cmem_sp;"
|
||||||
PRINT #12, "#include " + CHR$(34) + "data" + str2$(subfuncn) + ".txt" + CHR$(34)
|
PRINT #12, "#include " + CHR$(34) + "data" + str2$(subfuncn) + ".txt" + CHR$(34)
|
||||||
IF vWatchOn = 1 THEN
|
|
||||||
PRINT #12, "*__LONG_VWATCH_SUBLEVEL=*__LONG_VWATCH_SUBLEVEL+ 1 ;"
|
|
||||||
END IF
|
|
||||||
|
|
||||||
'create new _MEM lock for this scope
|
'create new _MEM lock for this scope
|
||||||
PRINT #12, "mem_lock *sf_mem_lock;" 'MUST not be static for recursion reasons
|
PRINT #12, "mem_lock *sf_mem_lock;" 'MUST not be static for recursion reasons
|
||||||
|
@ -5132,6 +5130,18 @@ DO
|
||||||
PRINT #12, "sf_mem_lock=mem_lock_tmp;"
|
PRINT #12, "sf_mem_lock=mem_lock_tmp;"
|
||||||
PRINT #12, "sf_mem_lock->type=3;"
|
PRINT #12, "sf_mem_lock->type=3;"
|
||||||
|
|
||||||
|
IF vWatchOn = 1 THEN
|
||||||
|
PRINT #12, "*__LONG_VWATCH_SUBLEVEL=*__LONG_VWATCH_SUBLEVEL+ 1 ;"
|
||||||
|
IF subfunc <> "SUB_VWATCH" THEN
|
||||||
|
temp$ = "FUNCTION "
|
||||||
|
IF id.subfunc = 2 THEN temp$ = "SUB "
|
||||||
|
temp$ = temp$ + subfuncoriginalname$
|
||||||
|
PRINT #12, "qbs_set(__STRING_VWATCH_SUBNAME,qbs_new_txt_len(" + CHR$(34) + temp$ + CHR$(34) + "," + str2$(LEN(temp$)) + "));"
|
||||||
|
PRINT #12, "qbs_cleanup(qbs_tmp_base,0);"
|
||||||
|
PRINT #12, "*__LONG_VWATCH_LINENUMBER=-2; SUB_VWATCH((ptrszint*)vwatch_local_vars);"
|
||||||
|
END IF
|
||||||
|
END IF
|
||||||
|
|
||||||
PRINT #12, "if (new_error) goto exit_subfunc;"
|
PRINT #12, "if (new_error) goto exit_subfunc;"
|
||||||
|
|
||||||
'statementn = statementn + 1
|
'statementn = statementn + 1
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
$CHECKING:OFF
|
$CHECKING:OFF
|
||||||
DIM SHARED AS LONG vwatch_linenumber, vwatch_sublevel
|
DIM SHARED AS LONG vwatch_linenumber, vwatch_sublevel
|
||||||
|
DIM SHARED AS STRING vwatch_subname
|
||||||
REDIM SHARED vwatch_breakpoints(0) AS _BYTE
|
REDIM SHARED vwatch_breakpoints(0) AS _BYTE
|
||||||
'next lines are just to avoid "unused variable" warnings:
|
'next lines are just to avoid "unused variable" warnings:
|
||||||
vwatch_linenumber = 0
|
vwatch_linenumber = 0
|
||||||
vwatch_sublevel = 0
|
vwatch_sublevel = 0
|
||||||
vwatch_breakpoints(0) = 0
|
vwatch_breakpoints(0) = 0
|
||||||
|
vwatch_subname = ""
|
||||||
$CHECKING:ON
|
$CHECKING:ON
|
||||||
|
|
|
@ -75,6 +75,11 @@ SUB vwatch (localVariables AS _OFFSET)
|
||||||
cmd$ = "error:" + MKL$(lastLine)
|
cmd$ = "error:" + MKL$(lastLine)
|
||||||
GOSUB SendCommand
|
GOSUB SendCommand
|
||||||
EXIT SUB
|
EXIT SUB
|
||||||
|
ELSEIF vwatch_linenumber = -2 THEN
|
||||||
|
'report a new sub/function has been "entered"
|
||||||
|
cmd$ = "call:" + vwatch_subname + MKL$(lastLine)
|
||||||
|
GOSUB SendCommand
|
||||||
|
EXIT SUB
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF vwatch_linenumber = lastLine THEN EXIT SUB
|
IF vwatch_linenumber = lastLine THEN EXIT SUB
|
||||||
|
|
2
source/utilities/vwatch_stub.bm
Normal file
2
source/utilities/vwatch_stub.bm
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
SUB vwatch ()
|
||||||
|
END SUB
|
Loading…
Reference in a new issue