mirror of https://github.com/buggins/dlangide.git
fix mago-mi compatibility
This commit is contained in:
parent
e59f9d1755
commit
b941610b81
|
@ -344,6 +344,34 @@ class GDBInterface : ConsoleDebuggerInterface, TextCommandTarget {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string quotePathIfNeeded(string s) {
|
||||||
|
char[] buf;
|
||||||
|
buf.assumeSafeAppend();
|
||||||
|
bool hasSpaces = false;
|
||||||
|
for(uint i = 0; i < s.length; i++) {
|
||||||
|
if (s[i] == ' ')
|
||||||
|
hasSpaces = true;
|
||||||
|
}
|
||||||
|
if (hasSpaces)
|
||||||
|
buf ~= '\"';
|
||||||
|
for(uint i = 0; i < s.length; i++) {
|
||||||
|
char ch = s[i];
|
||||||
|
if (ch == '\t')
|
||||||
|
buf ~= "\\t";
|
||||||
|
else if (ch == '\n')
|
||||||
|
buf ~= "\\n";
|
||||||
|
else if (ch == '\r')
|
||||||
|
buf ~= "\\r";
|
||||||
|
else if (ch == '\\')
|
||||||
|
buf ~= "\\\\";
|
||||||
|
else
|
||||||
|
buf ~= ch;
|
||||||
|
}
|
||||||
|
if (hasSpaces)
|
||||||
|
buf ~= '\"';
|
||||||
|
return buf.dup;
|
||||||
|
}
|
||||||
|
|
||||||
class AddBreakpointRequest : GDBRequest {
|
class AddBreakpointRequest : GDBRequest {
|
||||||
GDBBreakpoint gdbbp;
|
GDBBreakpoint gdbbp;
|
||||||
this(Breakpoint bp) {
|
this(Breakpoint bp) {
|
||||||
|
@ -353,7 +381,7 @@ class GDBInterface : ConsoleDebuggerInterface, TextCommandTarget {
|
||||||
cmd ~= "-break-insert ";
|
cmd ~= "-break-insert ";
|
||||||
if (!bp.enabled)
|
if (!bp.enabled)
|
||||||
cmd ~= "-d "; // create disabled
|
cmd ~= "-d "; // create disabled
|
||||||
cmd ~= bp.fullFilePath;
|
cmd ~= quotePathIfNeeded(bp.fullFilePath);
|
||||||
cmd ~= ":";
|
cmd ~= ":";
|
||||||
cmd ~= to!string(bp.line);
|
cmd ~= to!string(bp.line);
|
||||||
command = cmd.dup;
|
command = cmd.dup;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import std.utf;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
import core.thread;
|
import core.thread;
|
||||||
import core.sync.mutex;
|
import core.sync.mutex;
|
||||||
|
import dlangui.core.files;
|
||||||
|
|
||||||
/// interface to forward process output to
|
/// interface to forward process output to
|
||||||
interface TextWriter {
|
interface TextWriter {
|
||||||
|
@ -293,7 +294,12 @@ class ExternalProcess {
|
||||||
ExternalProcessState run(char[] program, char[][]args, char[] dir, TextWriter stdoutTarget, TextWriter stderrTarget = null) {
|
ExternalProcessState run(char[] program, char[][]args, char[] dir, TextWriter stdoutTarget, TextWriter stderrTarget = null) {
|
||||||
Log.d("ExternalProcess.run ", program, " ", args);
|
Log.d("ExternalProcess.run ", program, " ", args);
|
||||||
_state = ExternalProcessState.None;
|
_state = ExternalProcessState.None;
|
||||||
_program = program;
|
_program = findExecutablePath(cast(string)program).dup;
|
||||||
|
if (!_program) {
|
||||||
|
_state = ExternalProcessState.Error;
|
||||||
|
Log.e("Executable not found for ", program);
|
||||||
|
return _state;
|
||||||
|
}
|
||||||
_args = args;
|
_args = args;
|
||||||
_workDir = dir;
|
_workDir = dir;
|
||||||
_stdout = stdoutTarget;
|
_stdout = stdoutTarget;
|
||||||
|
|
Loading…
Reference in New Issue