diff --git a/internal/support/vwatch/vwatch.bm b/internal/support/vwatch/vwatch.bm index 3c1a3ad30..b4468d21f 100644 --- a/internal/support/vwatch/vwatch.bm +++ b/internal/support/vwatch/vwatch.bm @@ -7,6 +7,7 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) STATIC AS _OFFSET vw_idehwnd STATIC vw_buffer$ DIM AS LONG vw_i, vw_tempIndex, vw_localIndex, vw_varSize, vw_cmdsize + DIM AS LONG vw_arrayelementsize DIM AS _OFFSET vw_address, vw_elementoffset, vw_lbound, vw_ubound DIM AS _MEM vw_m, vw_m2 DIM AS _BYTE vw_isarray @@ -259,16 +260,17 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) vw_isarray = _CV(_BYTE, MID$(vw_value$, 5, 1)) vw_localIndex = CVL(MID$(vw_value$, 6, 4)) vw_arrayIndex = CVL(MID$(vw_value$, 10, 4)) - vw_elementoffset = _CV(_OFFSET, MID$(vw_value$, 14, LEN(vw_elementoffset))) - vw_varSize = CVL(MID$(vw_value$, 14 + LEN(vw_elementoffset), 4)) + vw_arrayelementsize = CVL(MID$(vw_value$, 14, 4)) + vw_elementoffset = _CV(_OFFSET, MID$(vw_value$, 18, LEN(vw_elementoffset))) + vw_varSize = CVL(MID$(vw_value$, 18 + LEN(vw_elementoffset), 4)) IF vw_varSize = 0 THEN GOTO cmdProcessingDone - vw_i = CVI(MID$(vw_value$, 18 + LEN(vw_elementoffset), 2)) + vw_i = CVI(MID$(vw_value$, 22 + LEN(vw_elementoffset), 2)) IF vw_i THEN - vw_scope$ = MID$(vw_value$, 20 + LEN(vw_elementoffset), vw_i) - vw_i = CVI(MID$(vw_value$, 20 + LEN(vw_elementoffset) + vw_i, 2)) + vw_scope$ = MID$(vw_value$, 24 + LEN(vw_elementoffset), vw_i) + vw_i = CVI(MID$(vw_value$, 24 + LEN(vw_elementoffset) + vw_i, 2)) vw_varType$ = RIGHT$(vw_value$, vw_i) ELSE - vw_i = CVI(MID$(vw_value$, 20 + LEN(vw_elementoffset), 2)) + vw_i = CVI(MID$(vw_value$, 24 + LEN(vw_elementoffset), 2)) vw_varType$ = RIGHT$(vw_value$, vw_i) END IF IF vw_cmd$ = "get global var" THEN @@ -312,7 +314,11 @@ SUB vwatch (globalVariables AS _OFFSET, localVariables AS _OFFSET) END IF 'this is where we calculate the actual element position in memory - vw_address = vw_address + ((vw_arrayIndex - vw_lbound) * vw_varSize) + IF vw_arrayelementsize = 0 THEN + vw_address = vw_address + ((vw_arrayIndex - vw_lbound) * vw_varSize) + ELSE + vw_address = vw_address + ((vw_arrayIndex - vw_lbound) * vw_arrayelementsize) + END IF END IF 'vw_address now points to the actual data diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index a72d2d4a5..7b84db512 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -7388,16 +7388,26 @@ SUB DebugMode tempIndex& = CVL(LEFT$(temp$, 4)) tempArrayIndex& = CVL(MID$(temp$, 5, 4)) temp$ = MID$(temp$, 9) - cmd$ = "" IF LEN(usedVariableList(tempIndex&).subfunc) = 0 THEN cmd$ = "get global var:" ELSE cmd$ = "get local var:" END IF GOSUB GetVarSize - IF LEN(cmd$) THEN - cmd$ = cmd$ + MKL$(tempIndex&) + _MK$(_BYTE, usedVariableList(tempIndex&).isarray) + MKL$(usedVariableList(tempIndex&).localIndex) + MKL$(tempArrayIndex&) + _MK$(_OFFSET, usedVariableList(tempIndex&).elementOffset) + MKL$(varSize&) + MKI$(LEN(usedVariableList(tempIndex&).subfunc)) + usedVariableList(tempIndex&).subfunc + MKI$(LEN(varType$)) + varType$ + IF varSize& THEN + cmd$ = cmd$ + MKL$(tempIndex&) + cmd$ = cmd$ + _MK$(_BYTE, usedVariableList(tempIndex&).isarray) + cmd$ = cmd$ + MKL$(usedVariableList(tempIndex&).localIndex) + cmd$ = cmd$ + MKL$(tempArrayIndex&) + cmd$ = cmd$ + MKL$(usedVariableList(tempIndex&).arrayElementSize) + cmd$ = cmd$ + _MK$(_OFFSET, usedVariableList(tempIndex&).elementOffset) + cmd$ = cmd$ + MKL$(varSize&) + cmd$ = cmd$ + MKI$(LEN(usedVariableList(tempIndex&).subfunc)) + cmd$ = cmd$ + usedVariableList(tempIndex&).subfunc + cmd$ = cmd$ + MKI$(LEN(varType$)) + varType$ GOSUB SendCommand + ELSE + cmd$ = "" END IF LOOP END IF @@ -8093,6 +8103,21 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction) usedVariableList(varDlgList(y).index).elements = v$ v$ = lineformat$(UCASE$(v$)) getid usedVariableList(varDlgList(y).index).id + IF id.t = 0 THEN + typ = id.arraytype AND 511 + IF id.arraytype AND ISINCONVENTIONALMEMORY THEN + typ = typ - ISINCONVENTIONALMEMORY + END IF + END IF + IF usedVariableList(varDlgList(y).index).isarray THEN + usedVariableList(varDlgList(y).index).arrayElementSize = udtxsize(typ) + IF udtxbytealign(typ) THEN + IF usedVariableList(varDlgList(y).index).arrayElementSize MOD 8 THEN usedVariableList(varDlgList(y).index).arrayElementSize = usedVariableList(varDlgList(y).index).arrayElementSize + (8 - (usedVariableList(varDlgList(y).index).arrayElementSize MOD 8)) 'round up to nearest byte + usedVariableList(varDlgList(y).index).arrayElementSize = usedVariableList(varDlgList(y).index).arrayElementSize \ 8 + END IF + ELSE + usedVariableList(varDlgList(y).index).arrayElementSize = 0 + END IF Error_Happened = 0 result$ = udtreference$("", v$, typ) IF Error_Happened THEN @@ -8149,7 +8174,6 @@ FUNCTION idevariablewatchbox$(currentScope$, filter$, selectVar, returnAction) GOTO unWatch END IF END SELECT - 'result = idemessagebox("Result", v$ + "\n" + result$ + "\n" + STR$(typ), "#OK") usedVariableList(varDlgList(y).index).elementOffset = VAL(MID$(result$, _INSTRREV(result$, sp3) + 1)) END IF ELSE diff --git a/source/qb64.bas b/source/qb64.bas index 17b51d8c7..42bea84ba 100644 --- a/source/qb64.bas +++ b/source/qb64.bas @@ -110,6 +110,7 @@ DIM SHARED MonochromeLoggingMode AS _BYTE TYPE usedVarList AS LONG id, linenumber, includeLevel, includedLine, scope, localIndex + AS LONG arrayElementSize AS _BYTE used, watch, isarray AS STRING name, cname, varType, includedFile, subfunc, mostRecentValue AS STRING watchRange, indexes, elements, elementTypes 'for Arrays and UDTs @@ -25984,6 +25985,7 @@ SUB manageVariableList (__name$, __cname$, localIndex AS LONG, action AS _BYTE) usedVariableList(i).isarray = 0 END IF usedVariableList(i).watchRange = "" + usedVariableList(i).arrayElementSize = 0 usedVariableList(i).indexes = "" usedVariableList(i).elements = "" usedVariableList(i).elementTypes = ""