From 47ce384c8b9741aa63294496a19f8667e5151b93 Mon Sep 17 00:00:00 2001 From: gambas Date: Fri, 5 Mar 2021 17:14:21 +0100 Subject: [PATCH] Tabs and newlines are now replaced by spaces inside error messages. Otherwise the debugger breaks. [GB.DEBUG] * BUG: Tabs and newlines are now replaced by spaces inside error messages. Otherwise the debugger breaks. --- main/lib/debug/debug.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/main/lib/debug/debug.c b/main/lib/debug/debug.c index 39524af9d..10116c8fa 100644 --- a/main/lib/debug/debug.c +++ b/main/lib/debug/debug.c @@ -683,10 +683,25 @@ void DEBUG_backtrace(FILE *out) static void debug_info() { + const char *p; + char c; + fprintf(_out, "*[%d]\t", getpid()); if (_error) - fputs(_error, _out); + { + p = _error; + for(;;) + { + c = *p++; + if (!c) + break; + + if (c == '\n' || c == '\r' || c == '\t') + c = ' '; + fputc(c, _out); + } + } fprintf(_out, "\t");