DebuggerCommand::onClient and DebuggerCommand::help do not return anything meaningful.
These commands invariably return true. This is more than a tad confusing to a new reader of the code. Refactor them to return void. Remove a few pieces of dead code that would log something if they ever returned false.
Esse commit está contido em:
@@ -21,7 +21,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdAbort::help(DebuggerClient *client) {
|
||||
void CmdAbort::help(DebuggerClient *client) {
|
||||
client->helpTitle("Abort Command");
|
||||
client->helpCmds(
|
||||
"[a]bort", "aborts current PHP code input",
|
||||
@@ -32,11 +32,10 @@ bool CmdAbort::help(DebuggerClient *client) {
|
||||
"ad-hoc PHP code to evaluate. In other words, it only works when you see "
|
||||
"continuation prompt like \">>>>\"."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdAbort::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdAbort::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
if (client->argCount() == 0) {
|
||||
client->tutorial(
|
||||
@@ -44,10 +43,9 @@ bool CmdAbort::onClientImpl(DebuggerClient *client) {
|
||||
"\"<?\" then decided to abort the input. So it only makes sense when "
|
||||
"you see continuation prompt like \">>>>\"."
|
||||
);
|
||||
return true;
|
||||
} else {
|
||||
help(client);
|
||||
}
|
||||
|
||||
return help(client);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -27,10 +27,10 @@ class CmdAbort : public DebuggerCommand {
|
||||
public:
|
||||
CmdAbort() : DebuggerCommand(KindOfAbort) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -74,7 +74,7 @@ void CmdBreak::list(DebuggerClient *client) {
|
||||
}
|
||||
|
||||
// The text to display when the debugger client processes "help break".
|
||||
bool CmdBreak::help(DebuggerClient *client) {
|
||||
void CmdBreak::help(DebuggerClient *client) {
|
||||
client->helpTitle("Break Command");
|
||||
client->helpCmds(
|
||||
"[b]reak", "breaks at current line of code",
|
||||
@@ -174,11 +174,10 @@ bool CmdBreak::help(DebuggerClient *client) {
|
||||
);
|
||||
|
||||
client->help("");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Carries out the "break list" command.
|
||||
bool CmdBreak::processList(DebuggerClient *client) {
|
||||
void CmdBreak::processList(DebuggerClient *client) {
|
||||
m_breakpoints = client->getBreakPoints();
|
||||
for (int i = 0; i < (int)m_breakpoints->size(); i++) {
|
||||
BreakPointInfoPtr bpi = m_breakpoints->at(i);
|
||||
@@ -195,18 +194,17 @@ bool CmdBreak::processList(DebuggerClient *client) {
|
||||
"Use '[b]reak [t]oggle {index}|[a]ll' to change their states."
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Carries out commands that change the status of a breakpoint.
|
||||
bool CmdBreak::processStatusChange(DebuggerClient *client) {
|
||||
void CmdBreak::processStatusChange(DebuggerClient *client) {
|
||||
m_breakpoints = client->getBreakPoints();
|
||||
if (m_breakpoints->empty()) {
|
||||
client->error("There is no breakpoint to clear or toggle.");
|
||||
client->tutorial(
|
||||
"Use '[b]reak ?|[h]elp' to read how to set breakpoints. "
|
||||
);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->argCount() == 1) {
|
||||
@@ -246,11 +244,11 @@ bool CmdBreak::processStatusChange(DebuggerClient *client) {
|
||||
}
|
||||
if (found) {
|
||||
updateServer(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
client->error("There is no current breakpoint to clear or toggle.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->arg(2, "all")) {
|
||||
@@ -258,7 +256,7 @@ bool CmdBreak::processStatusChange(DebuggerClient *client) {
|
||||
m_breakpoints->clear();
|
||||
updateServer(client);
|
||||
client->info("All breakpoints are cleared.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_breakpoints->size(); i++) {
|
||||
@@ -286,7 +284,7 @@ bool CmdBreak::processStatusChange(DebuggerClient *client) {
|
||||
"You will have to run '[b]reak [l]ist' first to see a list of valid "
|
||||
"numbers or indices to specify."
|
||||
);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
@@ -301,7 +299,7 @@ bool CmdBreak::processStatusChange(DebuggerClient *client) {
|
||||
client->error("\"%s\" is not a valid breakpoint index. Choose one from "
|
||||
"this list:", snum.c_str());
|
||||
processList(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
BreakPointInfoPtr bpi = (*m_breakpoints)[index];
|
||||
@@ -327,8 +325,6 @@ bool CmdBreak::processStatusChange(DebuggerClient *client) {
|
||||
client->info("Breakpoint %d's state is changed to %s.", bpi->index(),
|
||||
bpi->state(false).c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Uses the client to send this command to the server, which
|
||||
@@ -391,8 +387,8 @@ bool CmdBreak::addToBreakpointListAndUpdateServer(
|
||||
// Carries out the Break command. This always involves an action on the
|
||||
// client and usually, but not always, involves the server by sending
|
||||
// this command to the server and waiting for its response.
|
||||
bool CmdBreak::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdBreak::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
bool regex = false;
|
||||
BreakPointInfo::State state = BreakPointInfo::Always;
|
||||
@@ -405,9 +401,11 @@ bool CmdBreak::onClientImpl(DebuggerClient *client) {
|
||||
state = BreakPointInfo::Once;
|
||||
index++;
|
||||
} else if (client->arg(1, "list")) {
|
||||
return processList(client);
|
||||
processList(client);
|
||||
return;
|
||||
} else if (hasStatusChangeArg(client)) {
|
||||
return processStatusChange(client);
|
||||
processStatusChange(client);
|
||||
return;
|
||||
}
|
||||
|
||||
string currentFile;
|
||||
@@ -425,7 +423,7 @@ bool CmdBreak::onClientImpl(DebuggerClient *client) {
|
||||
if (currentFile.empty() || currentLine == 0) {
|
||||
client->error("There is no current file or line to set breakpoint. "
|
||||
"You will have to specify source file location yourself.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bpi = BreakPointInfoPtr(new BreakPointInfo(regex, state,
|
||||
@@ -464,7 +462,6 @@ bool CmdBreak::onClientImpl(DebuggerClient *client) {
|
||||
"\tmethod invoke: {cls}::{method}()\n"
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_id("id");
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
virtual void list(DebuggerClient *client);
|
||||
|
||||
// The text to display when the debugger client processes "help break".
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
// Updates the client with information about the execution of this command.
|
||||
// This information is not used by the command line client, but can
|
||||
@@ -54,7 +54,7 @@ protected:
|
||||
// Carries out the Break command. This always involves an action on the
|
||||
// client and usually, but not always, involves the server by sending
|
||||
// this command to the server and waiting for its response.
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
|
||||
// Serializes this command into the given Thrift buffer.
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
@@ -87,10 +87,10 @@ private:
|
||||
bool updateServer(DebuggerClient *client);
|
||||
|
||||
// Carries out the "break list" command.
|
||||
bool processList(DebuggerClient *client);
|
||||
void processList(DebuggerClient *client);
|
||||
|
||||
// Carries out commands that change the status of a breakpoint.
|
||||
bool processStatusChange(DebuggerClient *client);
|
||||
void processStatusChange(DebuggerClient *client);
|
||||
|
||||
// Returns true if the last command parsed by the client has
|
||||
// an argument that changes the status of a breakpoint.
|
||||
|
||||
@@ -33,7 +33,7 @@ void CmdComplete::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
void CmdComplete::list(DebuggerClient *client) {
|
||||
}
|
||||
|
||||
bool CmdComplete::help(DebuggerClient *client) {
|
||||
void CmdComplete::help(DebuggerClient *client) {
|
||||
client->helpTitle("Copmplete");
|
||||
client->help("complete <cmd>");
|
||||
client->helpBody(
|
||||
@@ -42,17 +42,15 @@ bool CmdComplete::help(DebuggerClient *client) {
|
||||
" readline library. This help is primarily for use by programs that"
|
||||
" need to access completion functionality."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdComplete::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdComplete::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
std::string text = client->lineRest(1);
|
||||
std::vector<std::string> res = client->getAllCompletions(text);
|
||||
for (size_t i = 0; i < res.size(); ++i) {
|
||||
client->print(res[i].c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdComplete::onServer(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -28,12 +28,12 @@ public:
|
||||
CmdComplete() : DebuggerCommand(KindOfComplete) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdConfig::help(DebuggerClient *client) {
|
||||
void CmdConfig::help(DebuggerClient *client) {
|
||||
client->helpTitle("Config Command");
|
||||
client->helpCmds("set <var> <value>", "set variable <var> to be <value>",
|
||||
"set", "list current values of variables",
|
||||
@@ -30,18 +30,18 @@ bool CmdConfig::help(DebuggerClient *client) {
|
||||
"Use this command to set up config variable, "
|
||||
"e.g. turning on/off a special mode."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 0) {
|
||||
listVars(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
std::string var = client->argValue(1);
|
||||
if (var == "help" || client->argCount() < 2) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string value = client->argValue(2);
|
||||
@@ -55,9 +55,9 @@ bool CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
client->print("BypassAccessCheck(bac) set to off");
|
||||
client->setDebuggerBypassCheck(false);
|
||||
} else {
|
||||
return help(client);
|
||||
help(client);
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (var == "LogFile" || var == "lf") {
|
||||
// Close the current log file handler
|
||||
@@ -84,17 +84,17 @@ bool CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
client->print("LogFile(lf) is set to %s", value == "" ? "off"
|
||||
: value.c_str());
|
||||
client->setLogFile(value);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (var == "PrintLevel" || var == "pl") {
|
||||
int pl = strtol(value.c_str(), nullptr, 10);
|
||||
if (pl > 0 && pl < DebuggerClient::MinPrintLevel) {
|
||||
client->error("%d is invalid for PrintLevel(pl)", pl);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
client->setDebuggerPrintLevel(pl);
|
||||
client->print("PrintLevel(pl) is set to %d", pl);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (var == "SmallStep" || var == "ss") {
|
||||
if (value == "on") {
|
||||
@@ -104,9 +104,9 @@ bool CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
client->print("SmallStep(ss) set to off");
|
||||
client->setDebuggerSmallStep(false);
|
||||
} else {
|
||||
return help(client);
|
||||
help(client);
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (var == "StackArgs" || var == "sa") {
|
||||
if (value == "on") {
|
||||
@@ -116,9 +116,9 @@ bool CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
client->print("StackArgs(sa) set to off");
|
||||
client->setDebuggerStackArgs(false);
|
||||
} else {
|
||||
return help(client);
|
||||
help(client);
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (var == "ApiModeSerialize") {
|
||||
assert(client->isApiMode());
|
||||
@@ -126,10 +126,8 @@ bool CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
client->setDebuggerClientApiModeSerialize(true);
|
||||
} else if (value == "off") {
|
||||
client->setDebuggerClientApiModeSerialize(false);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (var == "MaxCodeLines" || var == "mcl") {
|
||||
// MaxCodeLines: a useful configuration variable for emacs/hphpd-integration
|
||||
@@ -139,15 +137,14 @@ bool CmdConfig::onClientImpl(DebuggerClient *client) {
|
||||
int mcl = strtol(value.c_str(), nullptr, 10);
|
||||
if (mcl < -1) {
|
||||
client->error("%d is invalid for MaxCodeLines(mcl)", mcl);
|
||||
return true;
|
||||
} else {
|
||||
client->setDebuggerClientMaxCodeLines(mcl);
|
||||
client->print("MaxCodeLines(mcl) is set to %d", mcl);
|
||||
}
|
||||
client->setDebuggerClientMaxCodeLines(mcl);
|
||||
client->print("MaxCodeLines(mcl) is set to %d", mcl);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
listVars(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_BypassAccessCheck("BypassAccessCheck");
|
||||
|
||||
@@ -27,11 +27,11 @@ class CmdConfig : public DebuggerCommand {
|
||||
public:
|
||||
CmdConfig() : DebuggerCommand(KindOfConfig) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
private:
|
||||
void listVars(DebuggerClient *client);
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ void CmdConstant::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
thrift.read(m_constants);
|
||||
}
|
||||
|
||||
bool CmdConstant::help(DebuggerClient *client) {
|
||||
void CmdConstant::help(DebuggerClient *client) {
|
||||
client->helpTitle("Constant Command");
|
||||
client->helpCmds(
|
||||
"[k]onstant", "lists all constants",
|
||||
@@ -46,17 +46,17 @@ bool CmdConstant::help(DebuggerClient *client) {
|
||||
"that contain the text in their names or values. The search is case-"
|
||||
"insensitive and string-based."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdConstant::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdConstant::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
String text;
|
||||
if (client->argCount() == 1) {
|
||||
text = client->argValue(1);
|
||||
} else if (client->argCount() != 0) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
CmdConstantPtr cmd = client->xend<CmdConstant>(this);
|
||||
@@ -93,8 +93,6 @@ bool CmdConstant::onClientImpl(DebuggerClient *client) {
|
||||
client->info("(unable to find specified text in any constants)");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdConstant::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -27,13 +27,13 @@ class CmdConstant : public DebuggerCommand {
|
||||
public:
|
||||
CmdConstant() : DebuggerCommand(KindOfConstant) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdContinue::help(DebuggerClient *client) {
|
||||
void CmdContinue::help(DebuggerClient *client) {
|
||||
client->helpTitle("Continue Command");
|
||||
client->helpCmds(
|
||||
"[c]ontinue {count=1}", "continues program execution",
|
||||
@@ -31,7 +31,6 @@ bool CmdContinue::help(DebuggerClient *client) {
|
||||
"Use this command at break to resume program execution. Specify a "
|
||||
"count to repeat the same command many times."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdContinue::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class CmdContinue : public CmdFlowControl {
|
||||
public:
|
||||
CmdContinue() : CmdFlowControl(KindOfContinue) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdDown::help(DebuggerClient *client) {
|
||||
void CmdDown::help(DebuggerClient *client) {
|
||||
client->helpTitle("Down Command");
|
||||
client->helpCmds(
|
||||
"[d]own {num=1}", "moves to inner frames (callees) on stacktrace",
|
||||
@@ -34,18 +34,16 @@ bool CmdDown::help(DebuggerClient *client) {
|
||||
"current frame. By default it moves down by one level. Specify a number "
|
||||
"to move down several levels a time."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdDown::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdDown::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() > 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
} else {
|
||||
CmdWhere().fetchStackTrace(client);
|
||||
client->moveToFrame(client->getFrame() - CmdUp::ParseNumber(client));
|
||||
}
|
||||
|
||||
CmdWhere().fetchStackTrace(client);
|
||||
client->moveToFrame(client->getFrame() - CmdUp::ParseNumber(client));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdDown::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -27,11 +27,11 @@ class CmdDown : public DebuggerCommand {
|
||||
public:
|
||||
CmdDown() : DebuggerCommand(KindOfDown) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -36,7 +36,7 @@ void CmdEval::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
thrift.read(m_bypassAccessCheck);
|
||||
}
|
||||
|
||||
bool CmdEval::onClientImpl(DebuggerClient *client) {
|
||||
void CmdEval::onClientImpl(DebuggerClient *client) {
|
||||
m_body = client->getCode();
|
||||
m_frame = client->getFrame();
|
||||
m_bypassAccessCheck = client->getDebuggerBypassCheck();
|
||||
@@ -49,7 +49,6 @@ bool CmdEval::onClientImpl(DebuggerClient *client) {
|
||||
} else {
|
||||
res->handleReply(client);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdEval::handleReply(DebuggerClient *client) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
virtual void handleReply(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void CmdExample::list(DebuggerClient *client) {
|
||||
client->addCompletion("hip-hop-roll");
|
||||
}
|
||||
|
||||
bool CmdExample::help(DebuggerClient *client) {
|
||||
void CmdExample::help(DebuggerClient *client) {
|
||||
client->helpTitle("Example Command");
|
||||
client->helpCmds(
|
||||
"xample {string}", "it will tell you how long it is!",
|
||||
@@ -52,19 +52,18 @@ bool CmdExample::help(DebuggerClient *client) {
|
||||
"Modify command registration code at bottom of runtime/eval/debugger/cmd/"
|
||||
"cmd_extended.cpp and modify your new command by following this example."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdExample::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdExample::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
m_input = client->lineRest(2);
|
||||
CmdExamplePtr res = client->xend<CmdExample>(this);
|
||||
client->output("%d", res->m_output);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdExample::onServer(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -26,12 +26,12 @@ DECLARE_BOOST_TYPES(CmdExample);
|
||||
class CmdExample : public CmdExtended {
|
||||
public:
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ void CmdException::list(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdException::help(DebuggerClient *client) {
|
||||
void CmdException::help(DebuggerClient *client) {
|
||||
client->helpTitle("Exception Command");
|
||||
client->helpCmds(
|
||||
"[e]xception {cls}", "breaks if class of exception throws",
|
||||
@@ -64,13 +64,13 @@ bool CmdException::help(DebuggerClient *client) {
|
||||
"An exception breakpoint can be listed, cleared or toggled with '[b]reak' "
|
||||
"commands."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdException::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdException::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 0) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
bool regex = false;
|
||||
@@ -100,7 +100,6 @@ bool CmdException::onClientImpl(DebuggerClient *client) {
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdException::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -30,11 +30,11 @@ public:
|
||||
}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -93,54 +93,50 @@ ExtendedCommandMap CmdExtended::match(DebuggerClient *client, int argIndex) {
|
||||
return matches;
|
||||
}
|
||||
|
||||
bool CmdExtended::helpCommands(DebuggerClient *client,
|
||||
void CmdExtended::helpCommands(DebuggerClient *client,
|
||||
const ExtendedCommandMap &matches) {
|
||||
for (ExtendedCommandMap::const_iterator iter = matches.begin();
|
||||
iter != matches.end(); ++iter) {
|
||||
invokeHelp(client, iter->second);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdExtended::onClientImpl(DebuggerClient *client) {
|
||||
void CmdExtended::onClientImpl(DebuggerClient *client) {
|
||||
if (client->arg(1, "help") || client->arg(1, "?")) {
|
||||
if (client->argCount() == 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
ExtendedCommandMap matches = match(client, 2);
|
||||
if (matches.empty()) {
|
||||
return help(client);
|
||||
help(client);
|
||||
} else {
|
||||
helpCommands(client, matches);
|
||||
}
|
||||
return helpCommands(client, matches);
|
||||
return;
|
||||
}
|
||||
|
||||
ExtendedCommandMap matches = match(client, 1);
|
||||
if (matches.empty()) {
|
||||
return help(client);
|
||||
}
|
||||
if (matches.size() > 1) {
|
||||
help(client);
|
||||
} else if (matches.size() > 1) {
|
||||
client->error("Need more letters to tell which one of these:");
|
||||
for (ExtendedCommandMap::const_iterator iter = matches.begin();
|
||||
iter != matches.end(); ++iter) {
|
||||
client->error("\t%s", iter->first.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!invokeClient(client, matches.begin()->second)) {
|
||||
} else if (!invokeClient(client, matches.begin()->second)) {
|
||||
if (client->arg(2, "help") || client->arg(2, "?")) {
|
||||
return helpCommands(client, matches);
|
||||
helpCommands(client, matches);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool CmdExtended::help(DebuggerClient *client) {
|
||||
void CmdExtended::help(DebuggerClient *client) {
|
||||
client->helpTitle("Extended Command");
|
||||
helpImpl(client, "x");
|
||||
return true;
|
||||
}
|
||||
|
||||
const ExtendedCommandMap &CmdExtended::getCommandMap() {
|
||||
@@ -157,7 +153,8 @@ void CmdExtended::invokeList(DebuggerClient *client, const std::string &cls){
|
||||
bool CmdExtended::invokeHelp(DebuggerClient *client, const std::string &cls) {
|
||||
DebuggerCommandPtr cmd = CreateExtendedCommand(cls);
|
||||
if (cmd) {
|
||||
return cmd->help(client);
|
||||
cmd->help(client);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -165,7 +162,8 @@ bool CmdExtended::invokeHelp(DebuggerClient *client, const std::string &cls) {
|
||||
bool CmdExtended::invokeClient(DebuggerClient *client, const std::string &cls){
|
||||
DebuggerCommandPtr cmd = CreateExtendedCommand(cls);
|
||||
if (cmd) {
|
||||
return cmd->onClient(client);
|
||||
cmd->onClient(client);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
CmdExtended() : DebuggerCommand(KindOfExtended) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
@@ -46,12 +46,12 @@ public:
|
||||
virtual bool invokeClient(DebuggerClient *client, const std::string &cls);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
void helpImpl(DebuggerClient *client, const char *name);
|
||||
|
||||
private:
|
||||
ExtendedCommandMap match(DebuggerClient *client, int argIndex);
|
||||
bool helpCommands(DebuggerClient *client, const ExtendedCommandMap &matches);
|
||||
void helpCommands(DebuggerClient *client, const ExtendedCommandMap &matches);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -55,7 +55,7 @@ void CmdExtension::list(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdExtension::help(DebuggerClient *client) {
|
||||
void CmdExtension::help(DebuggerClient *client) {
|
||||
client->helpTitle("Extension Command");
|
||||
client->helpCmds(
|
||||
"x [t]ension", "lists all extensions",
|
||||
@@ -70,21 +70,17 @@ bool CmdExtension::help(DebuggerClient *client) {
|
||||
"version numbers, current status and cached data and by providing "
|
||||
"additional verbs to update runtime states for debugging purposes."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdExtension::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
|
||||
void CmdExtension::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
m_args = *client->args();
|
||||
|
||||
CmdExtensionPtr cmd = client->xend<CmdExtension>(this);
|
||||
if (cmd->m_out.empty()) {
|
||||
client->error(cmd->m_err);
|
||||
} else {
|
||||
client->print(cmd->m_out);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdExtension::processList(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -26,12 +26,12 @@ DECLARE_BOOST_TYPES(CmdExtension);
|
||||
class CmdExtension : public CmdExtended {
|
||||
public:
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -39,26 +39,27 @@ void CmdFlowControl::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
thrift.read(m_smallStep);
|
||||
}
|
||||
|
||||
bool CmdFlowControl::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdFlowControl::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
client->setFrame(0);
|
||||
|
||||
if (client->argCount() > 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->argCount() == 1) {
|
||||
string snum = client->argValue(1);
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client->error("Count needs to be a number.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
m_count = atoi(snum.c_str());
|
||||
if (m_count < 1) {
|
||||
client->error("Count needs to be a positive number.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_smallStep = client->getDebuggerSmallStep();
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
bool needsVMInterrupt() { return m_needsVMInterrupt; }
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdFrame::help(DebuggerClient *client) {
|
||||
void CmdFrame::help(DebuggerClient *client) {
|
||||
client->helpTitle("Frame Command");
|
||||
client->helpCmds(
|
||||
"[f]rame {index}", "jumps to one particular frame",
|
||||
@@ -34,18 +34,16 @@ bool CmdFrame::help(DebuggerClient *client) {
|
||||
"back to the most recent frame or the innermost frame. Use 'f 999' or "
|
||||
"some big number to jump to the outermost frame."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdFrame::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdFrame::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() != 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
} else {
|
||||
CmdWhere().fetchStackTrace(client);
|
||||
client->moveToFrame(CmdUp::ParseNumber(client));
|
||||
}
|
||||
|
||||
CmdWhere().fetchStackTrace(client);
|
||||
client->moveToFrame(CmdUp::ParseNumber(client));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdFrame::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -27,11 +27,11 @@ class CmdFrame : public DebuggerCommand {
|
||||
public:
|
||||
CmdFrame() : DebuggerCommand(KindOfFrame) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -32,7 +32,7 @@ void CmdGlobal::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
thrift.read(m_globals);
|
||||
}
|
||||
|
||||
bool CmdGlobal::help(DebuggerClient *client) {
|
||||
void CmdGlobal::help(DebuggerClient *client) {
|
||||
client->helpTitle("Global Command");
|
||||
client->helpCmds(
|
||||
"[g]lobal", "lists all global variables",
|
||||
@@ -45,17 +45,17 @@ bool CmdGlobal::help(DebuggerClient *client) {
|
||||
"text in their names or values. The search is case-insensitive and "
|
||||
"string-based."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdGlobal::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdGlobal::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
String text;
|
||||
if (client->argCount() == 1) {
|
||||
text = client->argValue(1);
|
||||
} else if (client->argCount() != 0) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
CmdGlobalPtr cmd = client->xend<CmdGlobal>(this);
|
||||
@@ -65,8 +65,6 @@ bool CmdGlobal::onClientImpl(DebuggerClient *client) {
|
||||
m_globals = cmd->m_globals;
|
||||
CmdVariable::PrintVariables(client, cmd->m_globals, true, text);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdGlobal::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -27,13 +27,13 @@ class CmdGlobal : public DebuggerCommand {
|
||||
public:
|
||||
CmdGlobal() : DebuggerCommand(KindOfGlobal) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ void CmdHelp::list(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdHelp::help(DebuggerClient *client) {
|
||||
void CmdHelp::help(DebuggerClient *client) {
|
||||
client->helpTitle("Help Command");
|
||||
client->helpCmds(
|
||||
"[h]elp [s]tart", "displays material for getting started",
|
||||
@@ -275,35 +275,24 @@ bool CmdHelp::help(DebuggerClient *client) {
|
||||
"To get detailed information of a command, type '{cmd} [h]elp' or '{cmd} "
|
||||
"?' or 'help {cmd}' or '? {cmd}'."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdHelp::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
|
||||
void CmdHelp::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 0) {
|
||||
HelpAll(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (client->arg(1, "start")) {
|
||||
} else if (client->arg(1, "start")) {
|
||||
HelpStarted(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (client->arg(1, "tutorial")) {
|
||||
} else if (client->arg(1, "tutorial")) {
|
||||
if (!processTutorial(client)) {
|
||||
return help(client);
|
||||
help(client);
|
||||
}
|
||||
} else {
|
||||
client->swapHelp();
|
||||
if (!client->process()) {
|
||||
help(client);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
client->swapHelp();
|
||||
if (client->process()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return help(client);
|
||||
}
|
||||
|
||||
bool CmdHelp::processTutorial(DebuggerClient *client) {
|
||||
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
CmdHelp() : DebuggerCommand(KindOfHelp) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
|
||||
private:
|
||||
bool processTutorial(DebuggerClient *client);
|
||||
|
||||
@@ -97,7 +97,7 @@ void CmdInfo::list(DebuggerClient *client) {
|
||||
client->addCompletion(DebuggerClient::AutoCompleteClassConstants);
|
||||
}
|
||||
|
||||
bool CmdInfo::help(DebuggerClient *client) {
|
||||
void CmdInfo::help(DebuggerClient *client) {
|
||||
client->helpTitle("Info Command");
|
||||
client->helpCmds(
|
||||
"info", "displays current function's info",
|
||||
@@ -111,7 +111,6 @@ bool CmdInfo::help(DebuggerClient *client) {
|
||||
client->helpBody(
|
||||
"Use this command to display declaration of a symbol."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdInfo::parseZeroArg(DebuggerClient *client) {
|
||||
@@ -145,8 +144,8 @@ void CmdInfo::parseOneArg(DebuggerClient *client, string &subsymbol) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdInfo::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdInfo::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
string subsymbol;
|
||||
|
||||
@@ -158,12 +157,13 @@ bool CmdInfo::onClientImpl(DebuggerClient *client) {
|
||||
"your program and it breaks at a function or a class method. It will "
|
||||
"then look up information about that function or method."
|
||||
);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
} else if (client->argCount() == 1) {
|
||||
parseOneArg(client, subsymbol);
|
||||
} else {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
CmdInfoPtr cmd = client->xend<CmdInfo>(this);
|
||||
@@ -177,7 +177,6 @@ bool CmdInfo::onClientImpl(DebuggerClient *client) {
|
||||
client->code(sb.detach());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdInfo::UpdateLiveLists(DebuggerClient *client) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
CmdInfo() : DebuggerCommand(KindOfInfo) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
static String FindSubSymbol(CArrRef symbols, const std::string &symbol);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void CmdInstrument::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
InstPointInfo::RecvImpl(m_ips, thrift);
|
||||
}
|
||||
|
||||
bool CmdInstrument::help(DebuggerClient *client) {
|
||||
void CmdInstrument::help(DebuggerClient *client) {
|
||||
client->helpTitle("Instrument Command");
|
||||
// TODO: more functionalities
|
||||
client->helpCmds("inst here <file> [desc]",
|
||||
@@ -53,23 +53,23 @@ bool CmdInstrument::help(DebuggerClient *client) {
|
||||
client->helpBody(
|
||||
"Use this command to instrument the program"
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdInstrument::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdInstrument::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 1) {
|
||||
if (client->argValue(1) == "list" || client->argValue(1) == "l") {
|
||||
listInst(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (client->argValue(1) == "clear" || client->argValue(1) == "c") {
|
||||
clearInst(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (client->argCount() < 2 || client->argValue(1) == "help") {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string loc = client->argValue(1);
|
||||
@@ -81,7 +81,7 @@ bool CmdInstrument::onClientImpl(DebuggerClient *client) {
|
||||
Variant code = f_file_get_contents(file.c_str());
|
||||
if (code.isNull()) {
|
||||
client->error("Unable to read from file %s", file.c_str());
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
m_instPoints = client->getInstPoints();
|
||||
if (loc == "here") {
|
||||
@@ -98,7 +98,7 @@ bool CmdInstrument::onClientImpl(DebuggerClient *client) {
|
||||
m_instPoints->push_back(ipi);
|
||||
} else {
|
||||
client->error("Not implemented\n");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
m_type = ActionWrite;
|
||||
CmdInstrumentPtr instCmdPtr = client->xend<CmdInstrument>(this);
|
||||
@@ -107,7 +107,6 @@ bool CmdInstrument::onClientImpl(DebuggerClient *client) {
|
||||
}
|
||||
client->setInstPoints(instCmdPtr->m_ips);
|
||||
CmdInstrument::PrintInstPoints(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_valid("valid");
|
||||
|
||||
@@ -29,12 +29,12 @@ public:
|
||||
CmdInstrument() : DebuggerCommand(KindOfInstrument), m_type(ActionRead),
|
||||
m_enabled(false), m_instPoints(nullptr) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ std::string CmdInterrupt::desc() const {
|
||||
return "";
|
||||
}
|
||||
|
||||
bool CmdInterrupt::onClientImpl(DebuggerClient *client) {
|
||||
void CmdInterrupt::onClientImpl(DebuggerClient *client) {
|
||||
client->setCurrentLocation(m_threadId, m_bpi);
|
||||
if (!client->getDebuggerSmallStep()) {
|
||||
// Adjust line and char if it's not small stepping
|
||||
@@ -252,8 +252,6 @@ bool CmdInterrupt::onClientImpl(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_format("format");
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
InterruptSite *getSite() { return m_site;}
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ void CmdList::list(DebuggerClient *client) {
|
||||
}
|
||||
|
||||
// The text to display when the debugger client processes "help break".
|
||||
bool CmdList::help(DebuggerClient *client) {
|
||||
void CmdList::help(DebuggerClient *client) {
|
||||
client->helpTitle("List Command");
|
||||
client->helpCmds(
|
||||
"list", "displays current block of source code",
|
||||
@@ -81,7 +81,6 @@ bool CmdList::help(DebuggerClient *client) {
|
||||
"will not be affected by this setting. This directory will be stored "
|
||||
"in configuration file for future sessions as well."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdList::listCurrent(DebuggerClient *client, int &line,
|
||||
@@ -173,10 +172,11 @@ bool CmdList::listFunctionOrClass(DebuggerClient *client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdList::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() > 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
int line = 0;
|
||||
@@ -187,7 +187,8 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
line = atoi(arg.c_str());
|
||||
if (line <= 0) {
|
||||
client->error("A line number has to be a positive integer.");
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
m_line1 = line - DebuggerClient::CodeBlockSize/2;
|
||||
m_line2 = m_line1 + DebuggerClient::CodeBlockSize;
|
||||
@@ -195,7 +196,7 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
if (!listFunctionOrClass(client)) {
|
||||
client->error("Unable to read specified method.");
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
} else {
|
||||
|
||||
size_t pos = arg.find(':');
|
||||
@@ -203,7 +204,8 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
m_file = arg.substr(0, pos);
|
||||
if (m_file.empty()) {
|
||||
client->error("File name cannot be empty.");
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
arg = arg.substr(pos + 1);
|
||||
}
|
||||
@@ -219,7 +221,8 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
m_line2 = DebuggerClient::CodeBlockSize;
|
||||
} else {
|
||||
client->error("Line numbers have to be integers.");
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
m_line1 = atoi(line1.c_str());
|
||||
@@ -232,7 +235,8 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
}
|
||||
if (m_line1 <= 0 || m_line2 <= 0) {
|
||||
client->error("Line numbers have to be positive integers.");
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -243,13 +247,15 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
m_line2 = DebuggerClient::CodeBlockSize;
|
||||
} else {
|
||||
client->error("A line number has to be an integer.");
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
int line = atoi(arg.c_str());
|
||||
if (line <= 0) {
|
||||
client->error("A line number has to be a positive integer.");
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
m_line1 = line - DebuggerClient::CodeBlockSize/2;
|
||||
m_line2 = m_line1 + DebuggerClient::CodeBlockSize;
|
||||
@@ -264,7 +270,7 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
|
||||
if (m_file.empty()) {
|
||||
if (listCurrent(client, line, charFocus0, lineFocus1, charFocus1)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
} else if (m_file[0] == '/') {
|
||||
struct stat sb;
|
||||
@@ -272,18 +278,17 @@ bool CmdList::onClientImpl(DebuggerClient *client) {
|
||||
if ((sb.st_mode & S_IFMT) == S_IFDIR) {
|
||||
client->setSourceRoot(m_file);
|
||||
client->info("PHP source root directory is set to %s", m_file.c_str());
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (listFileRange(client, line, charFocus0, lineFocus1, charFocus1)) {
|
||||
return true;
|
||||
return;
|
||||
} else if (client->argCount() != 1 || !listFunctionOrClass(client)) {
|
||||
client->error(
|
||||
"Unable to read specified function, class or source file location.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdList::onServer(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
virtual void list(DebuggerClient *client);
|
||||
|
||||
// The text to display when the debugger client processes "help break".
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
// Puts the specified range of the contents of the source file referenced
|
||||
// by this command in m_code and sends a copy of the updated command back
|
||||
@@ -51,7 +51,7 @@ protected:
|
||||
// server to get back the listing, updates the client with the current
|
||||
// position in the source file and displays a list of source lines to
|
||||
// the console.
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
|
||||
// Serializes this command into the given Thrift buffer.
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
@@ -51,7 +51,7 @@ void CmdMachine::list(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdMachine::help(DebuggerClient *client) {
|
||||
void CmdMachine::help(DebuggerClient *client) {
|
||||
client->helpTitle("Machine Command");
|
||||
client->helpCmds(
|
||||
"[m]achine [c]onnect {host}", "debugging remote server natively",
|
||||
@@ -97,7 +97,6 @@ bool CmdMachine::help(DebuggerClient *client) {
|
||||
"method calls as well, except classes will have to be loaded on client "
|
||||
"side by '=include(\"file-containing-the-class.php\")'."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdMachine::processList(DebuggerClient *client,
|
||||
@@ -193,14 +192,18 @@ void CmdMachine::UpdateIntercept(DebuggerClient *client,
|
||||
client->xend<CmdMachine>(&cmd);
|
||||
}
|
||||
|
||||
bool CmdMachine::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
if (client->argCount() == 0) return help(client);
|
||||
void CmdMachine::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 0) {
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
bool rpc = client->arg(1, "rpc");
|
||||
if (rpc || client->arg(1, "connect")) {
|
||||
if (client->argCount() != 2) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
string host = client->argValue(2);
|
||||
int port = 0;
|
||||
@@ -208,7 +211,8 @@ bool CmdMachine::onClientImpl(DebuggerClient *client) {
|
||||
if (pos != string::npos) {
|
||||
if (!DebuggerClient::IsValidNumber(host.substr(pos + 1))) {
|
||||
client->error("Port needs to be a number");
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
port = atoi(host.substr(pos + 1).c_str());
|
||||
host = host.substr(0, pos);
|
||||
@@ -224,7 +228,7 @@ bool CmdMachine::onClientImpl(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
client->initializeMachine();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->arg(1, "disconnect")) {
|
||||
@@ -232,12 +236,12 @@ bool CmdMachine::onClientImpl(DebuggerClient *client) {
|
||||
throw DebuggerConsoleExitException();
|
||||
}
|
||||
client->initializeMachine();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->arg(1, "list")) {
|
||||
processList(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->arg(1, "attach")) {
|
||||
@@ -254,7 +258,7 @@ bool CmdMachine::onClientImpl(DebuggerClient *client) {
|
||||
client->error("\"%s\" is not a valid sandbox index. Choose one from "
|
||||
"this list:", snum.c_str());
|
||||
processList(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -274,17 +278,18 @@ bool CmdMachine::onClientImpl(DebuggerClient *client) {
|
||||
sandbox->m_user = client->argValue(argBase);
|
||||
sandbox->m_name = client->argValue(argBase + 1);
|
||||
} else {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (AttachSandbox(client, sandbox, m_force)) {
|
||||
// Attach succeed, wait for next interrupt
|
||||
throw DebuggerConsoleExitException();
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
return help(client);
|
||||
help(client);
|
||||
}
|
||||
|
||||
bool CmdMachine::onServer(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -38,12 +38,12 @@ public:
|
||||
m_force(false), m_succeed(false) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void CmdMacro::list(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdMacro::help(DebuggerClient *client) {
|
||||
void CmdMacro::help(DebuggerClient *client) {
|
||||
client->helpTitle("Macro Command");
|
||||
client->helpCmds(
|
||||
"& [s]tart", "starts recording of default macro",
|
||||
@@ -52,7 +52,6 @@ bool CmdMacro::help(DebuggerClient *client) {
|
||||
"\n"
|
||||
"The space between & and command is not needed. '&s' works as well."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdMacro::processList(DebuggerClient *client) {
|
||||
@@ -64,10 +63,11 @@ void CmdMacro::processList(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdMacro::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdMacro::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 0) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->arg(1, "start")) {
|
||||
@@ -89,7 +89,7 @@ bool CmdMacro::onClientImpl(DebuggerClient *client) {
|
||||
"You will have to run '& [l]ist' first to see a list of valid "
|
||||
"numbers or indices to specify."
|
||||
);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
int num = atoi(snum.c_str());
|
||||
@@ -97,11 +97,9 @@ bool CmdMacro::onClientImpl(DebuggerClient *client) {
|
||||
client->error("\"%s\" is not a valid macro index. Choose one from "
|
||||
"this list:", snum.c_str());
|
||||
processList(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -28,10 +28,10 @@ public:
|
||||
CmdMacro() : DebuggerCommand(KindOfMacro) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
|
||||
private:
|
||||
void processList(DebuggerClient *client);
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdNext::help(DebuggerClient *client) {
|
||||
void CmdNext::help(DebuggerClient *client) {
|
||||
client->helpTitle("Next Command");
|
||||
client->helpCmds(
|
||||
"[n]ext {count=1}", "steps over lines of code",
|
||||
@@ -31,7 +31,6 @@ bool CmdNext::help(DebuggerClient *client) {
|
||||
"Use this command at break to step over lines of code. Specify a "
|
||||
"count to step over more than one line of code."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdNext::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class CmdNext : public CmdFlowControl {
|
||||
public:
|
||||
CmdNext() : CmdFlowControl(KindOfNext) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdOut::help(DebuggerClient *client) {
|
||||
void CmdOut::help(DebuggerClient *client) {
|
||||
client->helpTitle("Out Command");
|
||||
client->helpCmds(
|
||||
"[o]ut {count=1}", "steps out function calls",
|
||||
@@ -31,7 +31,6 @@ bool CmdOut::help(DebuggerClient *client) {
|
||||
"Use this command at break to step out function calls. Specify a "
|
||||
"count to step out more than one level of function calls."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdOut::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class CmdOut : public CmdFlowControl {
|
||||
public:
|
||||
CmdOut() : CmdFlowControl(KindOfOut) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
};
|
||||
|
||||
@@ -181,7 +181,7 @@ void CmdPrint::list(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdPrint::help(DebuggerClient *client) {
|
||||
void CmdPrint::help(DebuggerClient *client) {
|
||||
client->helpTitle("Print Command");
|
||||
client->helpCmds(
|
||||
"[p]rint {php}", "prints result of PHP code, (print_r)",
|
||||
@@ -205,10 +205,9 @@ bool CmdPrint::help(DebuggerClient *client) {
|
||||
"either at a breakpoint or caused by step commands, these expressions "
|
||||
"will be evaluated and printed out."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdPrint::processList(DebuggerClient *client) {
|
||||
void CmdPrint::processList(DebuggerClient *client) {
|
||||
DebuggerClient::WatchPtrVec &watches = client->getWatches();
|
||||
for (int i = 0; i < (int)watches.size(); i++) {
|
||||
client->print(" %d %s %s", i + 1,
|
||||
@@ -226,10 +225,9 @@ bool CmdPrint::processList(DebuggerClient *client) {
|
||||
"Use '[p]rint [c]lear {index}|[a]ll' to remove watch expression(s). "
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdPrint::processClear(DebuggerClient *client) {
|
||||
void CmdPrint::processClear(DebuggerClient *client) {
|
||||
DebuggerClient::WatchPtrVec &watches = client->getWatches();
|
||||
if (watches.empty()) {
|
||||
client->error("There is no watch expression to clear.");
|
||||
@@ -237,13 +235,13 @@ bool CmdPrint::processClear(DebuggerClient *client) {
|
||||
"Use '[p]rint [a]lways ...' to set new watch expressions. "
|
||||
"Use '[p]rint ?|[h]elp' to read how to set them. "
|
||||
);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->arg(2, "all")) {
|
||||
watches.clear();
|
||||
client->info("All watch expressions are cleared.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
string snum = client->argValue(2);
|
||||
@@ -253,7 +251,7 @@ bool CmdPrint::processClear(DebuggerClient *client) {
|
||||
"You will have to run '[p]rint [l]ist' first to see a list of valid "
|
||||
"numbers or indices to specify."
|
||||
);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
int num = atoi(snum.c_str()) - 1;
|
||||
@@ -261,11 +259,10 @@ bool CmdPrint::processClear(DebuggerClient *client) {
|
||||
client->error("\"%s\" is not a valid index. Choose one from this list:",
|
||||
snum.c_str());
|
||||
processList(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
watches.erase(watches.begin() + num);
|
||||
return true;
|
||||
}
|
||||
|
||||
Variant CmdPrint::processWatch(DebuggerClient *client, const char *format,
|
||||
@@ -287,10 +284,11 @@ void CmdPrint::handleReply(DebuggerClient *client) {
|
||||
client->output(m_ret);
|
||||
}
|
||||
|
||||
bool CmdPrint::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdPrint::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 0) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 1;
|
||||
@@ -298,15 +296,17 @@ bool CmdPrint::onClientImpl(DebuggerClient *client) {
|
||||
m_isForWatch = true;
|
||||
if (client->argCount() == 1) {
|
||||
client->error("'[p]rint [a]lways' needs an expression to watch.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
} else if (client->arg(1, "list")) {
|
||||
m_isForWatch = true;
|
||||
return processList(client);
|
||||
processList(client);
|
||||
return;
|
||||
} else if (client->arg(1, "clear")) {
|
||||
m_isForWatch = true;
|
||||
return processClear(client);
|
||||
processClear(client);
|
||||
return;
|
||||
}
|
||||
|
||||
const char *format = nullptr;
|
||||
@@ -320,7 +320,7 @@ bool CmdPrint::onClientImpl(DebuggerClient *client) {
|
||||
m_body = client->lineRest(index);
|
||||
if (m_isForWatch) {
|
||||
client->addWatch(format, m_body);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
m_bypassAccessCheck = client->getDebuggerBypassCheck();
|
||||
m_printLevel = client->getDebuggerPrintLevel();
|
||||
@@ -339,7 +339,6 @@ bool CmdPrint::onClientImpl(DebuggerClient *client) {
|
||||
}
|
||||
client->output(FormatResult(format, m_ret));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static const StaticString s_format("format");
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
m_isForWatch(false), m_noBreak(false) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
virtual void handleReply(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
@@ -57,8 +57,8 @@ private:
|
||||
bool m_isForWatch;
|
||||
bool m_noBreak;
|
||||
|
||||
bool processList(DebuggerClient *client);
|
||||
bool processClear(DebuggerClient *client);
|
||||
void processList(DebuggerClient *client);
|
||||
void processClear(DebuggerClient *client);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace HPHP { namespace Eval {
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
// The text to display when the debugger client processes "help quit".
|
||||
bool CmdQuit::help(DebuggerClient *client) {
|
||||
void CmdQuit::help(DebuggerClient *client) {
|
||||
TRACE(2, "CmdQuit::help\n");
|
||||
client->helpTitle("Quit Command");
|
||||
client->helpCmds(
|
||||
@@ -32,22 +32,20 @@ bool CmdQuit::help(DebuggerClient *client) {
|
||||
client->helpBody(
|
||||
"After you type this command, you will not see me anymore."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Carries out the Quit command by informing the server the client
|
||||
// is going away and then getting the client to quit.
|
||||
bool CmdQuit::onClientImpl(DebuggerClient *client) {
|
||||
void CmdQuit::onClientImpl(DebuggerClient *client) {
|
||||
TRACE(2, "CmdQuit::onClientImpl\n");
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
if (client->argCount() == 0) {
|
||||
client->sendToServer(this);
|
||||
client->quit();
|
||||
return true;
|
||||
} else {
|
||||
help(client);
|
||||
}
|
||||
|
||||
return help(client);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -28,12 +28,12 @@ public:
|
||||
CmdQuit() : DebuggerCommand(KindOfQuit) {}
|
||||
|
||||
// The text to display when the debugger client processes "help quit".
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
// Carries out the Quit command by informing the server the client
|
||||
// is going away and then getting the client to quit.
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void CmdRun::list(DebuggerClient *client) {
|
||||
client->addCompletion(DebuggerClient::AutoCompleteFileNames);
|
||||
}
|
||||
|
||||
bool CmdRun::help(DebuggerClient *client) {
|
||||
void CmdRun::help(DebuggerClient *client) {
|
||||
client->helpTitle("Run Command");
|
||||
client->helpCmds(
|
||||
"[r]un", "restarts program",
|
||||
@@ -52,11 +52,10 @@ bool CmdRun::help(DebuggerClient *client) {
|
||||
"In server mode, this command will simply abort current page handling "
|
||||
"without restarting anything."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdRun::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdRun::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
m_args = StringVecPtr(client->args(), null_deleter());
|
||||
m_smallStep = client->getDebuggerSmallStep();
|
||||
|
||||
@@ -28,12 +28,12 @@ public:
|
||||
CmdRun() : DebuggerCommand(KindOfRun) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void CmdShell::list(DebuggerClient *client) {
|
||||
client->addCompletion(DebuggerClient::AutoCompleteFileNames);
|
||||
}
|
||||
|
||||
bool CmdShell::help(DebuggerClient *client) {
|
||||
void CmdShell::help(DebuggerClient *client) {
|
||||
client->helpTitle("Shell Command");
|
||||
client->help("! {cmd} {arg1} {arg2} ... remotely executes shell command");
|
||||
client->helpBody(
|
||||
@@ -46,20 +46,17 @@ bool CmdShell::help(DebuggerClient *client) {
|
||||
"\n"
|
||||
"The space between ! and command is not needed. '!ls' works as well."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdShell::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdShell::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() == 0) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
m_args = *client->args();
|
||||
|
||||
CmdShellPtr cmd = client->xend<CmdShell>(this);
|
||||
client->print(cmd->m_out);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdShell::onServer(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -28,12 +28,12 @@ public:
|
||||
CmdShell() : DebuggerCommand(KindOfShell) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -31,10 +31,9 @@ void CmdSignal::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
thrift.read(m_signum);
|
||||
}
|
||||
|
||||
bool CmdSignal::onClientImpl(DebuggerClient *client) {
|
||||
void CmdSignal::onClientImpl(DebuggerClient *client) {
|
||||
m_signum = client->pollSignal();
|
||||
client->sendToServer(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdSignal::onServer(DebuggerProxy *proxy) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdStep::help(DebuggerClient *client) {
|
||||
void CmdStep::help(DebuggerClient *client) {
|
||||
client->helpTitle("Step Command");
|
||||
client->helpCmds(
|
||||
"[s]tep {count=1}", "steps into lines of code",
|
||||
@@ -31,7 +31,6 @@ bool CmdStep::help(DebuggerClient *client) {
|
||||
"Use this command at break to step into lines of code. Specify a "
|
||||
"count to step more than once."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdStep::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class CmdStep : public CmdFlowControl {
|
||||
public:
|
||||
CmdStep() : CmdFlowControl(KindOfStep) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt);
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ void CmdThread::list(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdThread::help(DebuggerClient *client) {
|
||||
void CmdThread::help(DebuggerClient *client) {
|
||||
client->helpTitle("Thread Command");
|
||||
client->helpCmds(
|
||||
"[t]hread", "displays current thread's information",
|
||||
@@ -80,7 +80,6 @@ bool CmdThread::help(DebuggerClient *client) {
|
||||
"[l]ist' command to display their indices, which can be used to switch "
|
||||
"between them with '[t]hread {index}'."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdThread::processList(DebuggerClient *client, bool output /* = true */) {
|
||||
@@ -101,10 +100,11 @@ void CmdThread::processList(DebuggerClient *client, bool output /* = true */) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdThread::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdThread::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() > 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (client->argCount() == 0) {
|
||||
@@ -139,7 +139,7 @@ bool CmdThread::onClientImpl(DebuggerClient *client) {
|
||||
"thread. If that's the only thread on the list, you do not have "
|
||||
"another thread at break to switch to."
|
||||
);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
int num = atoi(snum.c_str());
|
||||
@@ -151,13 +151,13 @@ bool CmdThread::onClientImpl(DebuggerClient *client) {
|
||||
client->error("\"%s\" is not a valid thread index. Choose one from "
|
||||
"this list:", snum.c_str());
|
||||
processList(client);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (thread->m_id == client->getCurrentThreadId()) {
|
||||
client->info("This is your current thread already.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
m_body = "switch";
|
||||
@@ -165,8 +165,6 @@ bool CmdThread::onClientImpl(DebuggerClient *client) {
|
||||
client->sendToServer(this);
|
||||
throw DebuggerConsoleExitException();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdThread::debuggerInfo(InfoVec &info) {
|
||||
|
||||
@@ -29,12 +29,12 @@ public:
|
||||
CmdThread() : DebuggerCommand(KindOfThread) {}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdUp::help(DebuggerClient *client) {
|
||||
void CmdUp::help(DebuggerClient *client) {
|
||||
client->helpTitle("Up Command");
|
||||
client->helpCmds(
|
||||
"[u]p {num=1}", "moves to outer frames (callers) on stacktrace",
|
||||
@@ -33,7 +33,6 @@ bool CmdUp::help(DebuggerClient *client) {
|
||||
"current frame. By default it moves up by one level. Specify a number "
|
||||
"to move up several levels a time."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
int CmdUp::ParseNumber(DebuggerClient *client) {
|
||||
@@ -51,15 +50,14 @@ int CmdUp::ParseNumber(DebuggerClient *client) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool CmdUp::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdUp::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() > 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
} else {
|
||||
CmdWhere().fetchStackTrace(client);
|
||||
client->moveToFrame(client->getFrame() + ParseNumber(client));
|
||||
}
|
||||
|
||||
CmdWhere().fetchStackTrace(client);
|
||||
client->moveToFrame(client->getFrame() + ParseNumber(client));
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdUp::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -30,11 +30,11 @@ public:
|
||||
public:
|
||||
CmdUp() : DebuggerCommand(KindOfUp) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ void CmdUser::list(DebuggerClient *client) {
|
||||
CmdExtended::list(client);
|
||||
}
|
||||
|
||||
bool CmdUser::help(DebuggerClient *client) {
|
||||
void CmdUser::help(DebuggerClient *client) {
|
||||
client->helpTitle("User Extended Command");
|
||||
helpImpl(client, "y");
|
||||
client->helpBody(
|
||||
@@ -69,7 +69,6 @@ bool CmdUser::help(DebuggerClient *client) {
|
||||
"Type '[i]nfo DebuggerProxy' for complete DebuggerProxy interface that "
|
||||
"you can use when implementing those $proxy callbacks."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
const ExtendedCommandMap &CmdUser::getCommandMap() {
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
Object getUserCommand() { return m_cmd;}
|
||||
|
||||
virtual void list(DebuggerClient *client);
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
virtual const ExtendedCommandMap &getCommandMap();
|
||||
|
||||
@@ -48,7 +48,7 @@ void CmdVariable::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
thrift.read(m_global);
|
||||
}
|
||||
|
||||
bool CmdVariable::help(DebuggerClient *client) {
|
||||
void CmdVariable::help(DebuggerClient *client) {
|
||||
client->helpTitle("Variable Command");
|
||||
client->helpCmds(
|
||||
"[v]ariable", "lists all local variables on stack",
|
||||
@@ -65,7 +65,6 @@ bool CmdVariable::help(DebuggerClient *client) {
|
||||
"either in their names or values. The search is case-insensitive and "
|
||||
"string-based."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdVariable::PrintVariables(DebuggerClient *client, CArrRef variables,
|
||||
@@ -111,14 +110,15 @@ void CmdVariable::PrintVariables(DebuggerClient *client, CArrRef variables,
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdVariable::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdVariable::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
String text;
|
||||
if (client->argCount() == 1) {
|
||||
text = client->argValue(1);
|
||||
} else if (client->argCount() != 0) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
m_frame = client->getFrame();
|
||||
@@ -129,8 +129,6 @@ bool CmdVariable::onClientImpl(DebuggerClient *client) {
|
||||
m_variables = cmd->m_variables;
|
||||
PrintVariables(client, cmd->m_variables, cmd->m_global, text);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdVariable::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -32,13 +32,13 @@ public:
|
||||
public:
|
||||
CmdVariable() : DebuggerCommand(KindOfVariable) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ void CmdWhere::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
thrift.read(m_stackArgs);
|
||||
}
|
||||
|
||||
bool CmdWhere::help(DebuggerClient *client) {
|
||||
void CmdWhere::help(DebuggerClient *client) {
|
||||
client->helpTitle("Where Command");
|
||||
client->helpCmds(
|
||||
"[w]here", "displays current stacktrace",
|
||||
@@ -59,7 +59,6 @@ bool CmdWhere::help(DebuggerClient *client) {
|
||||
"Use '[f]rame {index}' to jump to one particular frame. At any frame, "
|
||||
"use '[v]ariable' command to display all local variables."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
Array CmdWhere::fetchStackTrace(DebuggerClient *client) {
|
||||
@@ -73,10 +72,11 @@ Array CmdWhere::fetchStackTrace(DebuggerClient *client) {
|
||||
return st;
|
||||
}
|
||||
|
||||
bool CmdWhere::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdWhere::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
if (client->argCount() > 1) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return;
|
||||
}
|
||||
|
||||
Array st = fetchStackTrace(client);
|
||||
@@ -84,7 +84,7 @@ bool CmdWhere::onClientImpl(DebuggerClient *client) {
|
||||
client->info("(no stacktrace to display or in global scope)");
|
||||
client->info("if you hit serialization limit, consider do "
|
||||
"\"set sa off\" and then get the stack without args");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// so list command can default to current frame
|
||||
@@ -110,7 +110,7 @@ bool CmdWhere::onClientImpl(DebuggerClient *client) {
|
||||
}
|
||||
if (!DebuggerClient::IsValidNumber(snum)) {
|
||||
client->error("The argument, if specified, has to be numeric.");
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (num > 0) {
|
||||
for (int i = 0; i < num && i < st.size(); i++) {
|
||||
@@ -129,8 +129,6 @@ bool CmdWhere::onClientImpl(DebuggerClient *client) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CmdWhere::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -27,7 +27,7 @@ class CmdWhere : public DebuggerCommand {
|
||||
public:
|
||||
CmdWhere() : DebuggerCommand(KindOfWhere), m_stackArgs(true) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
virtual void setClientOutput(DebuggerClient *client);
|
||||
virtual bool onServer(DebuggerProxy *proxy);
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
void processStackTrace(); // server side
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
virtual void sendImpl(DebuggerThriftBuffer &thrift);
|
||||
virtual void recvImpl(DebuggerThriftBuffer &thrift);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace HPHP { namespace Eval {
|
||||
|
||||
TRACE_SET_MOD(debugger);
|
||||
|
||||
bool CmdZend::help(DebuggerClient *client) {
|
||||
void CmdZend::help(DebuggerClient *client) {
|
||||
client->helpTitle("Zend Command");
|
||||
client->helpCmds(
|
||||
"[z]end", "running the most recent code snippet in Zend PHP",
|
||||
@@ -35,21 +35,19 @@ bool CmdZend::help(DebuggerClient *client) {
|
||||
"note that only the most recent block of code you manually typed in was "
|
||||
"evaluated, not any earlier ones, nor the ones from a PHP file."
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdZend::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClientImpl(client)) return true;
|
||||
void CmdZend::onClientImpl(DebuggerClient *client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
if (client->argCount() == 0) {
|
||||
const std::string &code = client->getCode();
|
||||
string out;
|
||||
Process::Exec("php", nullptr, code.c_str(), out, &out, true);
|
||||
client->print(out);
|
||||
return true;
|
||||
} else {
|
||||
help(client);
|
||||
}
|
||||
|
||||
return help(client);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -27,10 +27,10 @@ class CmdZend : public DebuggerCommand {
|
||||
public:
|
||||
CmdZend() : DebuggerCommand(KindOfZend) {}
|
||||
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
protected:
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
virtual void onClientImpl(DebuggerClient *client);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -985,10 +985,7 @@ DebuggerCommandPtr DebuggerClient::waitForNextInterrupt() {
|
||||
return DebuggerCommandPtr();
|
||||
}
|
||||
if (cmd->is(DebuggerCommand::KindOfSignal)) {
|
||||
if (!cmd->onClient(this)) {
|
||||
Logger::Error("Unable to handle signal command.");
|
||||
return DebuggerCommandPtr();
|
||||
}
|
||||
cmd->onClient(this);
|
||||
continue;
|
||||
}
|
||||
if (!cmd->is(DebuggerCommand::KindOfInterrupt)) {
|
||||
@@ -1027,10 +1024,7 @@ void DebuggerClient::runImpl() {
|
||||
throw DebuggerServerLostException();
|
||||
}
|
||||
if (cmd->is(DebuggerCommand::KindOfSignal)) {
|
||||
if (!cmd->onClient(this)) {
|
||||
Logger::Error("%s: unable to poll signal", func);
|
||||
return;
|
||||
}
|
||||
cmd->onClient(this);
|
||||
continue;
|
||||
}
|
||||
if (!cmd->is(DebuggerCommand::KindOfInterrupt)) {
|
||||
@@ -1040,10 +1034,7 @@ void DebuggerClient::runImpl() {
|
||||
m_sigTime = 0;
|
||||
usageLogInterrupt(cmd);
|
||||
{
|
||||
if (!cmd->onClient(this)) {
|
||||
Logger::Error("%s: unable to process %d", func, cmd->getType());
|
||||
return;
|
||||
}
|
||||
cmd->onClient(this);
|
||||
}
|
||||
m_machine->m_interrupting = true;
|
||||
setClientState(StateReadyForCommand);
|
||||
@@ -1863,7 +1854,8 @@ DebuggerCommandPtr DebuggerClient::recvFromServer(int expected) {
|
||||
}
|
||||
|
||||
// eval() can cause more breakpoints
|
||||
if (!res->onClient(this) || !console()) {
|
||||
res->onClient(this);
|
||||
if (!console()) {
|
||||
if (m_quitting) {
|
||||
throw DebuggerClientExitException();
|
||||
} else {
|
||||
|
||||
@@ -149,30 +149,29 @@ void DebuggerCommand::list(DebuggerClient *client) {
|
||||
TRACE(2, "DebuggerCommand::list\n");
|
||||
}
|
||||
|
||||
bool DebuggerCommand::help(DebuggerClient *client) {
|
||||
void DebuggerCommand::help(DebuggerClient *client) {
|
||||
TRACE(2, "DebuggerCommand::help\n");
|
||||
assert(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the first argument of the command is "help" or "?"
|
||||
// this displays help text for the command and returns true.
|
||||
// Otherwise it returns false.
|
||||
bool DebuggerCommand::onClientImpl(DebuggerClient *client) {
|
||||
bool DebuggerCommand::displayedHelp(DebuggerClient *client) {
|
||||
TRACE(2, "DebuggerCommand::onClientImpl\n");
|
||||
if (client->arg(1, "help") || client->arg(1, "?")) {
|
||||
return help(client);
|
||||
help(client);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DebuggerCommand::onClient(DebuggerClient *client) {
|
||||
void DebuggerCommand::onClient(DebuggerClient *client) {
|
||||
TRACE(2, "DebuggerCommand::onClient\n");
|
||||
bool ret = onClientImpl(client);
|
||||
onClientImpl(client);
|
||||
if (client->isApiMode() && !m_incomplete) {
|
||||
setClientOutput(client);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DebuggerCommand::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
@@ -104,13 +104,13 @@ public:
|
||||
|
||||
// The text to display when the debugger client
|
||||
// processes "help <this command name>".
|
||||
virtual bool help(DebuggerClient *client);
|
||||
virtual void help(DebuggerClient *client);
|
||||
|
||||
// Carries out the command and returns true if the command completed.
|
||||
// Carries out the command, possibly by sending it to the server.
|
||||
// If the client is controlled via the API, the setClientOuput method
|
||||
// is invoked to update the client with the command output for access
|
||||
// via the API.
|
||||
bool onClient(DebuggerClient *client);
|
||||
void onClient(DebuggerClient *client);
|
||||
|
||||
// Updates the client with information about the execution of this command.
|
||||
// This information is not used by the command line client, but can
|
||||
@@ -135,9 +135,13 @@ public:
|
||||
String getWireError() const { return m_wireError; }
|
||||
|
||||
protected:
|
||||
// Client-side work for a command. Returns true if the command completed
|
||||
// successfully.
|
||||
virtual bool onClientImpl(DebuggerClient *client);
|
||||
// Carries out the command, possibly by sending it to the server.
|
||||
virtual void onClientImpl(DebuggerClient *client) = 0;
|
||||
|
||||
// If the first argument of the command is "help" or "?"
|
||||
// this displays help text for the command and returns true.
|
||||
// Otherwise it returns false.
|
||||
bool displayedHelp(DebuggerClient *client);
|
||||
|
||||
// Always called from send and must implement the subclass specific
|
||||
// logic for serializing a command to send via Thrift.
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário