From 33ec83d0fb91da4ebf2c998ed4fcf257f9b57b23 Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Thu, 22 Jul 2021 15:23:37 -0300 Subject: [PATCH] Adds Clear All Skips, Set TCP port. --- source/global/IDEsettings.bas | 5 ++ source/ide/ide_methods.bas | 79 ++++++++++++++++++++++++++++--- source/utilities/vwatch/vwatch.bm | 4 ++ 3 files changed, 81 insertions(+), 7 deletions(-) diff --git a/source/global/IDEsettings.bas b/source/global/IDEsettings.bas index d400b1eb5..4fbb771ce 100644 --- a/source/global/IDEsettings.bas +++ b/source/global/IDEsettings.bas @@ -18,6 +18,7 @@ DIM SHARED WhiteListQB64FirstTimeMsg AS _BYTE, ideautolayoutkwcapitals AS _BYTE DIM SHARED windowSettingsSection$, colorSettingsSection$, customDictionarySection$ DIM SHARED mouseSettingsSection$, generalSettingsSection$, displaySettingsSection$ DIM SHARED colorSchemesSection$, iniFolderIndex$, DebugInfoIniWarning$, ConfigFile$ +DIM SHARED idebaseTcpPort AS LONG windowSettingsSection$ = "IDE WINDOW" colorSettingsSection$ = "IDE COLOR SETTINGS" @@ -218,6 +219,10 @@ result = ReadConfigSetting(generalSettingsSection$, "BackupSize", value$) idebackupsize = VAL(value$) IF idebackupsize < 10 OR idebackupsize > 2000 THEN idebackupsize = 100: WriteConfigSetting generalSettingsSection$, "BackupSize", "100 'in MB" +result = ReadConfigSetting(generalSettingsSection$, "BaseTCPPort", value$) +idebaseTcpPort = VAL(value$) +IF idebaseTcpPort = 0 THEN idebaseTcpPort = 9000: WriteConfigSetting generalSettingsSection$, "BaseTCPPort", "9000" + result = ReadConfigSetting(generalSettingsSection$, "DebugInfo", value$) idedebuginfo = VAL(value$) IF UCASE$(LEFT$(value$, 4)) = "TRUE" THEN idedebuginfo = 1 diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index ce12d9ceb..6a9823a1e 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -344,6 +344,11 @@ FUNCTION ide2 (ignore) menuDesc$(m, i - 1) = "Removes all breakpoints" menu$(m, i) = "Toggle #Skip Line Ctrl+P": i = i + 1 menuDesc$(m, i - 1) = "Sets/clears flag to skip line" + menu$(m, i) = "#Unskip All Lines Ctrl+F10": i = i + 1 + menuDesc$(m, i - 1) = "Removes all line skip flags" + menu$(m, i) = "-": i = i + 1 + menu$(m, i) = "Set Base #TCP/IP Port Number...": i = i + 1 + menuDesc$(m, i - 1) = "Sets the initial port number for TCP/IP communication with the debuggee" menusize(m) = i - 1 m = m + 1: i = 0: OptionsMenuID = m @@ -693,14 +698,19 @@ FUNCTION ide2 (ignore) IF ideautorun THEN ideautorun = 0: GOTO idemrunspecial END IF - STATIC attemptToHost AS _BYTE + STATIC AS _BYTE attemptToHost, changingTcpPort IF vWatchOn = 1 AND attemptToHost = 0 THEN IF host& = 0 THEN - hostport$ = _TRIM$(STR$(9000 + tempfolderindex)) + hostport$ = _TRIM$(STR$(idebaseTcpPort + tempfolderindex)) ENVIRON "QB64DEBUGPORT=" + hostport$ host& = _OPENHOST("TCP/IP:" + hostport$) attemptToHost = -1 END IF + IF changingTcpPort AND (host& = 0) THEN + result = idemessagebox("$DEBUG MODE", "Cannot receive connections on port" + STR$(idebaseTcpPort) + ".\nCheck your firewall permissions.", "") + PCOPY 3, 0: SCREEN , , 3, 0 + END IF + changingTcpPort = 0 END IF IF c$ = CHR$(254) THEN @@ -1584,6 +1594,14 @@ FUNCTION ide2 (ignore) GOTO toggleBreakpoint END IF + IF KB = KEY_F10 THEN 'clear all breakpoints + IF KCTRL THEN + GOTO unskipAllLines + ELSE + GOTO clearAllBreakpoints + END IF + END IF + IF KB = KEY_F11 THEN 'make exe only idemexe: iderunmode = 2 @@ -5740,6 +5758,7 @@ FUNCTION ide2 (ignore) GOTO EnterDebugMode ELSE PCOPY 3, 0: SCREEN , , 3, 0 + clearAllBreakpoints: REDIM IdeBreakpoints(iden) AS _BYTE GOTO ideloop END IF @@ -5769,6 +5788,32 @@ FUNCTION ide2 (ignore) END IF END IF + IF menu$(m, s) = "#Unskip All Lines Ctrl+F10" THEN + IF IdeDebugMode = 2 THEN + IdeDebugMode = 15 + GOTO EnterDebugMode + ELSE + PCOPY 3, 0: SCREEN , , 3, 0 + unskipAllLines: + REDIM IdeSkipLines(iden) AS _BYTE + GOTO ideloop + END IF + END IF + + IF menu$(m, s) = "Set Base #TCP/IP Port Number..." THEN + PCOPY 2, 0 + bkpidebaseTcpPort = idebaseTcpPort + ideSetTCPPortBox + IF bkpidebaseTcpPort <> idebaseTcpPort THEN + IF host& <> 0 THEN CLOSE host&: host& = 0 + attemptToHost = 0 + changingTcpPort = -1 + idechangemade = 1 + END IF + PCOPY 3, 0: SCREEN , , 3, 0 + GOTO ideloop + END IF + IF menu$(m, s) = "Set #Next Line Ctrl+G" THEN IdeDebugMode = 13 GOTO EnterDebugMode @@ -6263,6 +6308,7 @@ SUB DebugMode result = idecy GOTO requestSetNextLine CASE 14: IdeDebugMode = 1: GOTO requestSubsDialog + CASE 15: IdeDebugMode = 1: GOTO requestUnskipAllLines END SELECT COLOR 0, 7: _PRINTSTRING (1, 1), SPACE$(LEN(menubar$)) @@ -6280,7 +6326,7 @@ SUB DebugMode dummy = DarkenFGBG(0) clearStatusWindow 1 setStatusMessage 1, "Failed to initiate debug session.", 7 - setStatusMessage 2, "Cannot receive connections. Check your firewall permissions.", 2 + setStatusMessage 2, "Cannot receive connections on port" + STR$(idebaseTcpPort) + ". Check your firewall permissions.", 2 WHILE _MOUSEINPUT: WEND EXIT SUB END IF @@ -6761,10 +6807,17 @@ SUB DebugMode GOSUB UpdateDisplay END IF CASE 17408 'F10 - requestClearBreakpoints: - REDIM IdeBreakpoints(iden) AS _BYTE - cmd$ = "clear all breakpoints" - GOSUB SendCommand + IF _KEYDOWN(100306) OR _KEYDOWN(100305) THEN + requestUnskipAllLines: + REDIM IdeSkipLines(iden) AS _BYTE + cmd$ = "clear all skips" + GOSUB SendCommand + ELSE + requestClearBreakpoints: + REDIM IdeBreakpoints(iden) AS _BYTE + cmd$ = "clear all breakpoints" + GOSUB SendCommand + END IF GOSUB UpdateDisplay CASE 103, 71 'g, G IF _KEYDOWN(100306) OR _KEYDOWN(100305) THEN @@ -11829,6 +11882,16 @@ SUB idegotobox ideselect = 0 END SUB +SUB ideSetTCPPortBox + a2$ = str2$(idebaseTcpPort) + v$ = ideinputbox$("Base TCP/IP Port Number", "#Port number for $DEBUG mode", a2$, "0123456789", 45, 5) + IF v$ = "" THEN EXIT SUB + + idebaseTcpPort = VAL(v$) + IF idebaseTcpPort = 0 THEN idebaseTcpPort = 9000 + WriteConfigSetting generalSettingsSection$, "BaseTCPPort", str2$(idebaseTcpPort) +END SUB + FUNCTION idegetlinenumberbox(title$, initialValue&) a2$ = str2$(initialValue&) IF a2$ = "0" THEN a2$ = "" @@ -14488,6 +14551,8 @@ SUB IdeMakeContextualMenu menuDesc$(m, i - 1) = "Removes all breakpoints" menu$(m, i) = "Toggle #Skip Line Ctrl+P": i = i + 1 menuDesc$(m, i - 1) = "Sets/clears flag to skip line" + menu$(m, i) = "#Unskip All Lines Ctrl+F10": i = i + 1 + menuDesc$(m, i - 1) = "Removes all line skip flags" menu$(m, i) = "-": i = i + 1 menu$(m, i) = "SUBs... F2": i = i + 1 menuDesc$(m, i - 1) = "Displays a list of SUB/FUNCTION procedures" diff --git a/source/utilities/vwatch/vwatch.bm b/source/utilities/vwatch/vwatch.bm index 59dc05577..31ca30aa6 100644 --- a/source/utilities/vwatch/vwatch.bm +++ b/source/utilities/vwatch/vwatch.bm @@ -136,6 +136,8 @@ SUB vwatch (localVariables AS _OFFSET) vwatch_skiplines(CVL(value$)) = 0 CASE "clear all breakpoints" REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE + CASE "clear all skips" + REDIM vwatch_skiplines(UBOUND(vwatch_skiplines)) AS _BYTE END SELECT IF vwatch_skiplines(vwatch_linenumber) THEN vwatch_goto = -vwatch_linenumber: EXIT SUB @@ -206,6 +208,8 @@ SUB vwatch (localVariables AS _OFFSET) vwatch_breakpoints(CVL(value$)) = 0 CASE "clear all breakpoints" REDIM vwatch_breakpoints(UBOUND(vwatch_breakpoints)) AS _BYTE + CASE "clear all skips" + REDIM vwatch_skiplines(UBOUND(vwatch_skiplines)) AS _BYTE CASE "call stack" 'send call stack history" GOSUB SendCallStack