kopia lustrzana https://github.com/c9/core
fix php debugger
rodzic
58b6fa3d98
commit
6cdaa63230
|
@ -112,9 +112,6 @@ DbgpSession.prototype.end = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
DbgpSession.prototype._handleInit = function(init) {
|
DbgpSession.prototype._handleInit = function(init) {
|
||||||
if (this.initialized)
|
|
||||||
throw new Error("Cannot initialize debugger session more than once");
|
|
||||||
|
|
||||||
this.protocolVersion = init["@protocol_version"];
|
this.protocolVersion = init["@protocol_version"];
|
||||||
|
|
||||||
this.appId = init["@appid"];
|
this.appId = init["@appid"];
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
var net = require("net");
|
var net = require("net");
|
||||||
|
var fs = require("fs");
|
||||||
|
|
||||||
var debug = function() {};
|
var debug = function() {};
|
||||||
// var debug = require("debug")("netproxy");
|
// var debug = console.error.bind(console);
|
||||||
|
var socketPath = process.env.HOME + "/.c9/xdebug.sock";
|
||||||
|
if (process.platform == "win32")
|
||||||
|
socketPath = "\\\\.\\pipe\\" + socketPath.replace(/\//g, "\\");
|
||||||
|
|
||||||
var host = "{HOST}" || "127.0.0.1";
|
var host = "{HOST}" || "127.0.0.1";
|
||||||
var port = parseInt("{PORT}", 10) || 9000;
|
var port = parseInt("{PORT}", 10) || 9000;
|
||||||
|
@ -22,7 +25,7 @@ function send() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---
|
/*** --- ***/
|
||||||
|
|
||||||
var browserServer = net.createServer(function(client) {
|
var browserServer = net.createServer(function(client) {
|
||||||
debug("browserClient::connect");
|
debug("browserClient::connect");
|
||||||
|
@ -36,8 +39,6 @@ var browserServer = net.createServer(function(client) {
|
||||||
browserClient.on("end", function() {
|
browserClient.on("end", function() {
|
||||||
debug("browserClient::end");
|
debug("browserClient::end");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
// if (debugClient)
|
|
||||||
// debugClient.end();
|
|
||||||
browserClient = null;
|
browserClient = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,8 +59,17 @@ var browserServer = net.createServer(function(client) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
browserServer.listen(port + 1, host, function() {
|
|
||||||
debug("netproxy listening for browser on port " + (port + 1));
|
if (process.platform !== "win32") {
|
||||||
|
try {
|
||||||
|
fs.unlinkSync(socketPath);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code != "ENOENT")
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
browserServer.listen(socketPath, function() {
|
||||||
|
debug("netproxy listening for " + socketPath);
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -67,8 +77,12 @@ browserServer.on("error", function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
browserServer.on("close", function(err) {
|
||||||
|
console.log(err);
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
// ---
|
/*** --- ***/
|
||||||
|
|
||||||
var debugServer = net.createServer(function(client) {
|
var debugServer = net.createServer(function(client) {
|
||||||
debug("debugClient::connect");
|
debug("debugClient::connect");
|
||||||
|
@ -84,9 +98,6 @@ var debugServer = net.createServer(function(client) {
|
||||||
debugClient.on("end", function() {
|
debugClient.on("end", function() {
|
||||||
debug("debugClient::end");
|
debug("debugClient::end");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
// debugClient = null;
|
|
||||||
// if (browserClient)
|
|
||||||
// browserClient.end();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
debugClient.on("data", function(data) {
|
debugClient.on("data", function(data) {
|
||||||
|
@ -116,7 +127,7 @@ debugServer.on("error", function(err) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// --
|
/*** --- ***/
|
||||||
|
|
||||||
var I = 0;
|
var I = 0;
|
||||||
function start() {
|
function start() {
|
||||||
|
|
|
@ -452,11 +452,17 @@ define(function(require, exports, module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProxySource(process) {
|
function getProxySource(process) {
|
||||||
return PROXY
|
var socketPath = c9.home + "/.c9/xdebug.sock";
|
||||||
.replace(/\/\/.*/g, "")
|
if (c9.platform == "win32")
|
||||||
.replace(/[\n\r]/g, "")
|
socketPath = "\\\\.\\pipe\\" + socketPath.replace(/\//g, "\\");
|
||||||
.replace(/\{HOST\}/, process.runner.debughost || "")
|
return {
|
||||||
.replace(/\{PORT\}/, process.runner.debugport);
|
source: PROXY
|
||||||
|
.replace(/^\s*\/\/.*/gm, "")
|
||||||
|
.replace(/[\n\r]/g, "")
|
||||||
|
.replace(/\{HOST\}/, process.runner.debughost || "")
|
||||||
|
.replace(/\{PORT\}/, process.runner.debugport),
|
||||||
|
port: socketPath
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBreakpoints(breakpoints, callback) {
|
function setBreakpoints(breakpoints, callback) {
|
||||||
|
|
Ładowanie…
Reference in New Issue