egg

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 87201c08455d509bdc8f86f5d3d7262ea82ca430
parent 29de311d28a4241436e7418fef75a2cf9dfd9154
Author: Gabriel G. de Brito <gabrielgbrito@icloud.com>
Date:   Fri, 15 Mar 2024 20:57:36 -0300

Fixed panic when inputing nothing in the debugger prompt

Diffstat:
Mdebugger.go | 46+++++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/debugger.go b/debugger.go @@ -515,27 +515,31 @@ func debugMachine(m machine.Machine, sym []assembler.DebuggerToken, prog []uint8 } } - switch wsl[0] { - case "help", "h": - debuggerHelp() - case "print", "p": - debuggerPrint(m, sym, wsl[1:]) - case "next", "n": - debuggerNext(m, sym, in) - case "continue", "c": - debuggerContinue(m, sym, breakpoints, in) - case "break", "b": - debuggerBreakpoint(m, sym, &breakpoints, wsl[1:]) - case "remove", "r": - debuggerRemove(m, sym, &breakpoints, wsl[1:]) - case "dump", "d": - debuggerDump(m, wsl[1:], prog) - case "exit", "e", "quit", "q": - goto EXIT - case "ping": - fmt.Println("pong!") - default: - fmt.Printf("no such command: %v\n", wsl[0]) + if len(wsl) > 0 { + switch wsl[0] { + case "help", "h": + debuggerHelp() + case "print", "p": + debuggerPrint(m, sym, wsl[1:]) + case "next", "n": + debuggerNext(m, sym, in) + case "continue", "c": + debuggerContinue(m, sym, breakpoints, in) + case "break", "b": + debuggerBreakpoint(m, sym, &breakpoints, wsl[1:]) + case "remove", "r": + debuggerRemove(m, sym, &breakpoints, wsl[1:]) + case "dump", "d": + debuggerDump(m, wsl[1:], prog) + case "exit", "e", "quit", "q": + goto EXIT + case "ping": + fmt.Println("pong!") + default: + fmt.Printf("no such command: %v\n", wsl[0]) + } + } else { + fmt.Println("") } fmt.Print("egg> ")