From ac07ac9868221041932dcc4474eccb67bc8c6e97 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Mon, 16 May 2016 23:09:46 +0300 Subject: [PATCH] debugger support fixes --- src/ddebug/gdb/gdbinterface.d | 4 +++- src/dlangide/builders/builder.d | 11 ++++++++++- src/dlangide/builders/extprocess.d | 10 ++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/ddebug/gdb/gdbinterface.d b/src/ddebug/gdb/gdbinterface.d index 1108dda..680d7d4 100644 --- a/src/ddebug/gdb/gdbinterface.d +++ b/src/ddebug/gdb/gdbinterface.d @@ -33,6 +33,7 @@ abstract class ConsoleDebuggerInterface : DebuggerBase, TextWriter { protected void onDebuggerStdoutLine(string line) { } private void onStdoutText(string text) { + Log.v("onStdoutText: ", text); _stdoutBuf ~= text; // pass full lines int startPos = 0; @@ -53,6 +54,7 @@ abstract class ConsoleDebuggerInterface : DebuggerBase, TextWriter { } } if (fullLinesFound) { + //Log.v("onStdoutText: full lines found"); for (int i = 0; i + startPos < _stdoutBuf.length; i++) _stdoutBuf[i] = _stdoutBuf[i + startPos]; _stdoutBuf.length = _stdoutBuf.length - startPos; @@ -632,7 +634,7 @@ class GDBInterface : ConsoleDebuggerInterface, TextCommandTarget { } override protected void onDebuggerStdoutLine(string gdbLine) { - //Log.d("GDB stdout: '", line, "'"); + Log.d("GDB stdout: '", gdbLine, "'"); string line = gdbLine; if (line.empty) return; diff --git a/src/dlangide/builders/builder.d b/src/dlangide/builders/builder.d index 0d47f2b..a791109 100644 --- a/src/dlangide/builders/builder.d +++ b/src/dlangide/builders/builder.d @@ -69,8 +69,17 @@ class Builder : BackgroundOperationWatcher { scope(exit)pollText(); ExternalProcessState state = _extprocess.state; if (state == ExternalProcessState.None) { + import dlangui.core.files; + string exepath = findExecutablePath(_executable); + if (!exepath) { + _finished = true; + destroy(_extprocess); + _extprocess = null; + return; + } + _log.clear(); - char[] program = _executable.dup; + char[] program = exepath.dup; char[][] params; char[] dir = _project.dir.dup; diff --git a/src/dlangide/builders/extprocess.d b/src/dlangide/builders/extprocess.d index 5053a3f..a381c16 100644 --- a/src/dlangide/builders/extprocess.d +++ b/src/dlangide/builders/extprocess.d @@ -111,11 +111,13 @@ class BackgroundReaderBase : Thread { _bytes.length = _bytes.length ? _bytes.length * 2 : 1024; bool eolchar = (data == '\r' || data == '\n'); bool preveol = (prevchar == '\r' || prevchar == '\n'); - if ((eolchar && !preveol) || (!eolchar && preveol)) { - //Log.d("Flushing for prevChar=", prevchar, " newChar=", data); - flush(); - } _bytes[_len++] = data; + if (data == '\n') + flush(); + //if ((eolchar && !preveol) || (!eolchar && preveol) || data == '\n') { + // //Log.d("Flushing for prevChar=", prevchar, " newChar=", data); + // flush(); + //} prevchar = data; } void flush() {