From 08efb46d41bc06c193cba85edfe00522bb81626d Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sun, 31 May 2020 20:32:00 +0300 Subject: [PATCH] =?UTF-8?q?Made=20the=20command=20line=20debugger=20output?= =?UTF-8?q?=20=E2=80=9C>=E2=80=9D=20before=20inputs,=20added=20special=20m?= =?UTF-8?q?agic=20sequence=20to=20break=20the=20debugger=20from=20stdin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/gb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Core/gb.c b/Core/gb.c index ce9b9af..1bc2235 100644 --- a/Core/gb.c +++ b/Core/gb.c @@ -62,6 +62,9 @@ static char *default_input_callback(GB_gameboy_t *gb) { char *expression = NULL; size_t size = 0; + if (gb->debug_stopped) { + printf(">"); + } if (getline(&expression, &size, stdin) == -1) { /* The user doesn't have STDIN or used ^D. We make sure the program keeps running. */ @@ -77,6 +80,12 @@ static char *default_input_callback(GB_gameboy_t *gb) if (expression[length - 1] == '\n') { expression[length - 1] = 0; } + + if (expression[0] == '\x03') { + gb->debug_stopped = true; + free(expression); + return strdup(""); + } return expression; }