diff --git a/hphp/runtime/eval/debugger/cmd/cmd.cpp.template b/hphp/runtime/eval/debugger/cmd/cmd.cpp.template index 9a5acaf1b..bc2942340 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd.cpp.template +++ b/hphp/runtime/eval/debugger/cmd/cmd.cpp.template @@ -27,21 +27,21 @@ void CmdMachine::recvImpl(DebuggerThriftBuffer &thrift) { DebuggerCommand::recvImpl(thrift); } -void CmdMachine::list(DebuggerClient *client) { +void CmdMachine::list(DebuggerClient &client) { } -bool CmdMachine::help(DebuggerClient *client) { - client->error("not implemented yet"); return true; +bool CmdMachine::help(DebuggerClient &client) { + client.error("not implemented yet"); return true; - client->helpTitle("Machine Command"); - client->help("machine: "); - client->helpBody( + client.helpTitle("Machine Command"); + client.help("machine: "); + client.helpBody( "" ); return true; } -bool CmdMachine::onClient(DebuggerClient *client) { +bool CmdMachine::onClient(DebuggerClient &client) { if (DebuggerCommand::onClient(client)) return true; //TODO @@ -49,7 +49,7 @@ bool CmdMachine::onClient(DebuggerClient *client) { return help(client); } -bool CmdMachine::onServer(DebuggerProxy *proxy) { +bool CmdMachine::onServer(DebuggerProxy &proxy) { assert(false); // this command is processed entirely locally return false; } diff --git a/hphp/runtime/eval/debugger/cmd/cmd.h.template b/hphp/runtime/eval/debugger/cmd/cmd.h.template index 180890387..d090339c6 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd.h.template +++ b/hphp/runtime/eval/debugger/cmd/cmd.h.template @@ -27,11 +27,11 @@ class CmdMachine : public DebuggerCommand { public: CmdMachine() : DebuggerCommand(KindOfMachine) {} - virtual void list(DebuggerClient *client); - virtual bool help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual bool help(DebuggerClient &client); - virtual bool onClient(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onClient(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_abort.cpp b/hphp/runtime/eval/debugger/cmd/cmd_abort.cpp index 27e6c0646..22f999ec4 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_abort.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_abort.cpp @@ -21,24 +21,24 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdAbort::help(DebuggerClient *client) { - client->helpTitle("Abort Command"); - client->helpCmds( +void CmdAbort::help(DebuggerClient &client) { + client.helpTitle("Abort Command"); + client.helpCmds( "[a]bort", "aborts current PHP code input", nullptr ); - client->helpBody( + client.helpBody( "You will have to type this command on a new line, while you're typing " "ad-hoc PHP code to evaluate. In other words, it only works when you see " "continuation prompt like \">>>>\"." ); } -void CmdAbort::onClientImpl(DebuggerClient *client) { +void CmdAbort::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { - client->tutorial( + if (client.argCount() == 0) { + client.tutorial( "This command only works when you started typing ad-hoc PHP code with " "\">>>\"." diff --git a/hphp/runtime/eval/debugger/cmd/cmd_abort.h b/hphp/runtime/eval/debugger/cmd/cmd_abort.h index 39aa74d7b..c3fc95f5f 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_abort.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_abort.h @@ -27,10 +27,10 @@ class CmdAbort : public DebuggerCommand { public: CmdAbort() : DebuggerCommand(KindOfAbort) {} - virtual void help(DebuggerClient *client); + virtual void help(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_break.cpp b/hphp/runtime/eval/debugger/cmd/cmd_break.cpp index a1f1f0847..6720112e2 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_break.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_break.cpp @@ -40,10 +40,10 @@ void CmdBreak::recvImpl(DebuggerThriftBuffer &thrift) { // Informs the client of all strings that may follow a break command. // Used for auto completion. The client uses the prefix of the argument // following the command to narrow down the list displayed to the user. -void CmdBreak::list(DebuggerClient *client) { - if (client->argCount() == 0 || - (client->argCount() == 1 && - (client->arg(1, "regex") || client->arg(1, "once")))) { +void CmdBreak::list(DebuggerClient &client) { + if (client.argCount() == 0 || + (client.argCount() == 1 && + (client.arg(1, "regex") || client.arg(1, "once")))) { static const char *keywords1[] = { "regex", "once", @@ -57,26 +57,26 @@ void CmdBreak::list(DebuggerClient *client) { "disable", nullptr }; - client->addCompletion(keywords1); - client->addCompletion(DebuggerClient::AutoCompleteFileNames); - client->addCompletion(DebuggerClient::AutoCompleteFunctions); - client->addCompletion(DebuggerClient::AutoCompleteClasses); - client->addCompletion(DebuggerClient::AutoCompleteClassMethods); - } else if (client->argCount() == 1) { + client.addCompletion(keywords1); + client.addCompletion(DebuggerClient::AutoCompleteFileNames); + client.addCompletion(DebuggerClient::AutoCompleteFunctions); + client.addCompletion(DebuggerClient::AutoCompleteClasses); + client.addCompletion(DebuggerClient::AutoCompleteClassMethods); + } else if (client.argCount() == 1) { if (hasStatusChangeArg(client)) { - client->addCompletion("all"); - } else if (!client->arg(1, "list")) { - client->addCompletion(DebuggerClient::AutoCompleteFileNames); + client.addCompletion("all"); + } else if (!client.arg(1, "list")) { + client.addCompletion(DebuggerClient::AutoCompleteFileNames); } } else { - client->addCompletion(DebuggerClient::AutoCompleteCode); + client.addCompletion(DebuggerClient::AutoCompleteCode); } } // The text to display when the debugger client processes "help break". -void CmdBreak::help(DebuggerClient *client) { - client->helpTitle("Break Command"); - client->helpCmds( +void CmdBreak::help(DebuggerClient &client) { + client.helpTitle("Break Command"); + client.helpCmds( "[b]reak", "breaks at current line of code", "[b]reak {exp}", "breaks at matching location", "", "", @@ -105,8 +105,8 @@ void CmdBreak::help(DebuggerClient *client) { nullptr ); - client->helpTitle("Where to break?"); - client->helpSection( + client.helpTitle("Where to break?"); + client.helpSection( "There are many ways to specify a source file location to set a " "breakpoint, but it's ONE single string without whitespaces. The " "format looks like this,\n" @@ -122,8 +122,8 @@ void CmdBreak::help(DebuggerClient *client) { "\tb MyClass::foo()\n" ); - client->helpTitle("Special Breakpoints"); - client->helpSection( + client.helpTitle("Special Breakpoints"); + client.helpSection( "There are special breakpoints what can only be set by names:\n" "\n" "\tstart\n" @@ -138,8 +138,8 @@ void CmdBreak::help(DebuggerClient *client) { "'end', because end of a request is the same as beginning of psp." ); - client->helpTitle("Conditional Breakpoints and Watchpoints"); - client->helpSection( + client.helpTitle("Conditional Breakpoints and Watchpoints"); + client.helpSection( "Every breakpoint can specify a condition, which is an arbitrary PHP " "expression that will be evaluated to TRUE or FALSE. When TRUE, it will " "break. When FALSE, it will continue without break. \"&&\" is similar to " @@ -151,8 +151,8 @@ void CmdBreak::help(DebuggerClient *client) { "So every time it breaks at mypage.php line 123, it will print out $a." ); - client->helpTitle("Breakpoint States and List"); - client->helpSection( + client.helpTitle("Breakpoint States and List"); + client.helpSection( "Every breakpoint has 3 states: ALWAYS, ONCE, DISABLED. Without keyword " "\"once\", a breakpoint is in ALWAYS state. ONCE breakpoints will turn " "into DISABLED after it's hit once. DISABLED breakpoints will not break, " @@ -165,31 +165,31 @@ void CmdBreak::help(DebuggerClient *client) { "different machines, sandboxes and threads." ); - client->helpTitle("Hard Breakpoints"); - client->helpSection( + client.helpTitle("Hard Breakpoints"); + client.helpSection( "From within PHP code, you can place a function call hphpd_break() to " "embed a breakpoint. You may also specify a condition as the function's " "parameter, so it breaks when the condition is met. Please read about " "this function for more details with '[i]nfo hphpd_break'." ); - client->help(""); + client.help(""); } // Carries out the "break list" command. -void CmdBreak::processList(DebuggerClient *client) { - m_breakpoints = client->getBreakPoints(); +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); - client->print(" %d\t%s %s", bpi->index(), bpi->state(true).c_str(), + client.print(" %d\t%s %s", bpi->index(), bpi->state(true).c_str(), bpi->desc().c_str()); } if (m_breakpoints->empty()) { - client->tutorial( + client.tutorial( "Use '[b]reak ?|[h]elp' to read how to set breakpoints. " ); } else { - client->tutorial( + client.tutorial( "Use '[b]reak [c]lear {index}|[a]ll' to remove breakpoint(s). " "Use '[b]reak [t]oggle {index}|[a]ll' to change their states." ); @@ -197,19 +197,19 @@ void CmdBreak::processList(DebuggerClient *client) { } // Carries out commands that change the status of a breakpoint. -void CmdBreak::processStatusChange(DebuggerClient *client) { - m_breakpoints = client->getBreakPoints(); +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( + client.error("There is no breakpoint to clear or toggle."); + client.tutorial( "Use '[b]reak ?|[h]elp' to read how to set breakpoints. " ); return; } - if (client->argCount() == 1) { - BreakPointInfoPtrVec *matched = client->getMatchedBreakPoints(); - BreakPointInfoPtrVec *bps = client->getBreakPoints(); + if (client.argCount() == 1) { + BreakPointInfoPtrVec *matched = client.getMatchedBreakPoints(); + BreakPointInfoPtrVec *bps = client.getBreakPoints(); bool found = false; for (unsigned int i = 0; i < matched->size(); i++) { BreakPointInfoPtr bpm = (*matched)[i]; @@ -237,7 +237,7 @@ void CmdBreak::processStatusChange(DebuggerClient *client) { action = "updated"; bp->toggle(); } - client->info("Breakpoint %d is %s %s", bp->index(), + client.info("Breakpoint %d is %s %s", bp->index(), action, bp->site().c_str()); found = true; } @@ -247,15 +247,15 @@ void CmdBreak::processStatusChange(DebuggerClient *client) { return; } - client->error("There is no current breakpoint to clear or toggle."); + client.error("There is no current breakpoint to clear or toggle."); return; } - if (client->arg(2, "all")) { + if (client.arg(2, "all")) { if (hasClearArg(client)) { m_breakpoints->clear(); updateServer(client); - client->info("All breakpoints are cleared."); + client.info("All breakpoints are cleared."); return; } @@ -277,10 +277,10 @@ void CmdBreak::processStatusChange(DebuggerClient *client) { return processList(client); } - string snum = client->argValue(2); + string snum = client.argValue(2); if (!DebuggerClient::IsValidNumber(snum)) { - client->error("'[b]reak [c]lear|[t]oggle' needs an {index} argument."); - client->tutorial( + client.error("'[b]reak [c]lear|[t]oggle' needs an {index} argument."); + client.tutorial( "You will have to run '[b]reak [l]ist' first to see a list of valid " "numbers or indices to specify." ); @@ -296,7 +296,7 @@ void CmdBreak::processStatusChange(DebuggerClient *client) { } } if (index < 0) { - client->error("\"%s\" is not a valid breakpoint index. Choose one from " + client.error("\"%s\" is not a valid breakpoint index. Choose one from " "this list:", snum.c_str()); processList(client); return; @@ -306,23 +306,23 @@ void CmdBreak::processStatusChange(DebuggerClient *client) { if (hasClearArg(client)) { m_breakpoints->erase(m_breakpoints->begin() + index); updateServer(client); - client->info("Breakpoint %d cleared %s", bpi->index(), + client.info("Breakpoint %d cleared %s", bpi->index(), bpi->desc().c_str()); } else if (hasEnableArg(client)) { bpi->setState(BreakPointInfo::Always); updateServer(client); - client->info("Breakpoint %d's state is changed to %s.", bpi->index(), + client.info("Breakpoint %d's state is changed to %s.", bpi->index(), bpi->state(false).c_str()); } else if (hasDisableArg(client)) { bpi->setState(BreakPointInfo::Disabled); updateServer(client); - client->info("Breakpoint %d's state is changed to %s.", bpi->index(), + client.info("Breakpoint %d's state is changed to %s.", bpi->index(), bpi->state(false).c_str()); } else { assert(hasToggleArg(client)); bpi->toggle(); updateServer(client); - client->info("Breakpoint %d's state is changed to %s.", bpi->index(), + client.info("Breakpoint %d's state is changed to %s.", bpi->index(), bpi->state(false).c_str()); } } @@ -331,17 +331,17 @@ void CmdBreak::processStatusChange(DebuggerClient *client) { // will update its breakpoint list with the one in this command. // The client will block until the server echoes // this command back to it. The echoed command is discarded. -bool CmdBreak::updateServer(DebuggerClient *client) { +bool CmdBreak::updateServer(DebuggerClient &client) { m_body = "update"; - client->xend(this); + client.xend(this); return true; } // Creates a new CmdBreak instance, sets its breakpoints to the client's // list, sends the command to the server and waits for a response. -bool CmdBreak::SendClientBreakpointListToServer(DebuggerClient *client) { +bool CmdBreak::SendClientBreakpointListToServer(DebuggerClient &client) { auto cmd = CmdBreak(); - cmd.m_breakpoints = client->getBreakPoints(); + cmd.m_breakpoints = client.getBreakPoints(); return cmd.updateServer(client); } @@ -350,25 +350,25 @@ bool CmdBreak::SendClientBreakpointListToServer(DebuggerClient *client) { // to the server so that it too can update it's list. // Returns false if the breakpoint is not well formed. bool CmdBreak::addToBreakpointListAndUpdateServer( - DebuggerClient *client, BreakPointInfoPtr bpi, int index) { + DebuggerClient &client, BreakPointInfoPtr bpi, int index) { ++index; - if (client->arg(index, "if")) { - bpi->setClause(client->lineRest(++index), true); - } else if (client->arg(index, "&&")) { - bpi->setClause(client->lineRest(++index), false); + if (client.arg(index, "if")) { + bpi->setClause(client.lineRest(++index), true); + } else if (client.arg(index, "&&")) { + bpi->setClause(client.lineRest(++index), false); } if (bpi->valid()) { - m_breakpoints = client->getBreakPoints(); + m_breakpoints = client.getBreakPoints(); for (int i = 0; i < (int)m_breakpoints->size(); i++) { if ((*m_breakpoints)[i]->same(bpi)) { - client->error("Breakpoint was already set previously."); + client.error("Breakpoint was already set previously."); return true; } } m_breakpoints->push_back(bpi); updateServer(client); - client->info("Breakpoint %d set %s", bpi->index(), bpi->desc().c_str()); + client.info("Breakpoint %d set %s", bpi->index(), bpi->desc().c_str()); return true; } @@ -377,9 +377,9 @@ bool CmdBreak::addToBreakpointListAndUpdateServer( // into a separate check and report method and report from there. // See task 2368334. if (!bpi->m_url.empty()) { - client->error("@{url} cannot be specified alone."); + client.error("@{url} cannot be specified alone."); } else { - client->error("Breakpoint was not set in right format."); + client.error("Breakpoint was not set in right format."); } return false; } @@ -387,20 +387,20 @@ 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. -void CmdBreak::onClientImpl(DebuggerClient *client) { +void CmdBreak::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; bool regex = false; BreakPointInfo::State state = BreakPointInfo::Always; int index = 1; - if (client->arg(1, "regex")) { + if (client.arg(1, "regex")) { regex = true; index++; - } else if (client->arg(1, "once")) { + } else if (client.arg(1, "once")) { state = BreakPointInfo::Once; index++; - } else if (client->arg(1, "list")) { + } else if (client.arg(1, "list")) { processList(client); return; } else if (hasStatusChangeArg(client)) { @@ -410,7 +410,7 @@ void CmdBreak::onClientImpl(DebuggerClient *client) { string currentFile; int currentLine = 0; - BreakPointInfoPtr loc = client->getCurrentLocation(); + BreakPointInfoPtr loc = client.getCurrentLocation(); if (loc) { currentFile = loc->m_file; currentLine = loc->m_line1; @@ -419,9 +419,9 @@ void CmdBreak::onClientImpl(DebuggerClient *client) { BreakPointInfoPtr bpi; InterruptType interrupt = (InterruptType)(-1); - if (client->argCount() == 0) { + if (client.argCount() == 0) { if (currentFile.empty() || currentLine == 0) { - client->error("There is no current file or line to set breakpoint. " + client.error("There is no current file or line to set breakpoint. " "You will have to specify source file location yourself."); return; } @@ -429,28 +429,28 @@ void CmdBreak::onClientImpl(DebuggerClient *client) { bpi = BreakPointInfoPtr(new BreakPointInfo(regex, state, currentFile.c_str(), currentLine)); - } else if (client->arg(index, "start")) { + } else if (client.arg(index, "start")) { interrupt = RequestStarted; - } else if (client->arg(index, "end")) { + } else if (client.arg(index, "end")) { interrupt = RequestEnded; - } else if (client->arg(index, "psp")) { + } else if (client.arg(index, "psp")) { interrupt = PSPEnded; } else { bpi = BreakPointInfoPtr(new BreakPointInfo(regex, state, BreakPointReached, - client->argValue(index), + client.argValue(index), currentFile)); } if (interrupt >= 0) { string url; - if (!client->arg(index + 1, "if") && !client->arg(index + 1, "&&")) { - url = client->argValue(++index); + if (!client.arg(index + 1, "if") && !client.arg(index + 1, "&&")) { + url = client.argValue(++index); } bpi = BreakPointInfoPtr(new BreakPointInfo(regex, state, interrupt, url)); } if (!addToBreakpointListAndUpdateServer(client, bpi, index)) { - client->tutorial( + client.tutorial( "This is the order of different arguments:\n" "\n" "\t[b]reak [o]nce {exp} if|&& {php}\n" @@ -485,11 +485,11 @@ static const StaticString s_desc("desc"); // Updates the client with information about the execution of this command. // This information is not used by the command line client, but can be accessed // via the debugger client API exposed to PHP programs. -void CmdBreak::setClientOutput(DebuggerClient *client) { +void CmdBreak::setClientOutput(DebuggerClient &client) { // Output an array of current breakpoints including exceptions - client->setOutputType(DebuggerClient::OTValues); + client.setOutputType(DebuggerClient::OTValues); Array values; - m_breakpoints = client->getBreakPoints(); + m_breakpoints = client.getBreakPoints(); for (int i = 0; i < (int)m_breakpoints->size(); i++) { BreakPointInfoPtr bpi = m_breakpoints->at(i); Array breakpoint; @@ -514,18 +514,18 @@ void CmdBreak::setClientOutput(DebuggerClient *client) { breakpoint.set(s_desc, bpi->desc()); values.append(breakpoint); } - client->setOTValues(values); + client.setOTValues(values); } // Updates the breakpoint list in the proxy with the new list // received from the client. Then sends the command back to the // client as confirmation. Returns false if the confirmation message // send failed. -bool CmdBreak::onServer(DebuggerProxy *proxy) { +bool CmdBreak::onServer(DebuggerProxy &proxy) { if (m_body == "update") { - proxy->setBreakPoints(m_bps); + proxy.setBreakPoints(m_bps); m_breakpoints = &m_bps; - return proxy->sendToClient(this); + return proxy.sendToClient(this); } return false; } @@ -533,7 +533,7 @@ bool CmdBreak::onServer(DebuggerProxy *proxy) { // Returns true if the last command parsed by the client has // an argument that changes the status of a breakpoint. // I.e. clear, enable, disable or toggle. -bool CmdBreak::hasStatusChangeArg(DebuggerClient *client) { +bool CmdBreak::hasStatusChangeArg(DebuggerClient &client) { return hasClearArg(client) || hasEnableArg(client) || hasDisableArg(client) || hasToggleArg(client); @@ -541,26 +541,26 @@ bool CmdBreak::hasStatusChangeArg(DebuggerClient *client) { // Returns true if the last command parsed by the client has // the string "enable" in its first argument position. -bool CmdBreak::hasEnableArg(DebuggerClient *client) { - return client->arg(1, "enable"); +bool CmdBreak::hasEnableArg(DebuggerClient &client) { + return client.arg(1, "enable"); } // Returns true if the last command parsed by the client has // the string "disable" in its first argument position. -bool CmdBreak::hasDisableArg(DebuggerClient *client) { - return client->arg(1, "disable"); +bool CmdBreak::hasDisableArg(DebuggerClient &client) { + return client.arg(1, "disable"); } // Returns true if the last command parsed by the client has // the string "clear" in its first argument position. -bool CmdBreak::hasClearArg(DebuggerClient *client) { - return client->arg(1, "clear"); +bool CmdBreak::hasClearArg(DebuggerClient &client) { + return client.arg(1, "clear"); } // Returns true if the last command parsed by the client has // the string "toggle" in its first argument position. -bool CmdBreak::hasToggleArg(DebuggerClient *client) { - return client->arg(1, "toggle"); +bool CmdBreak::hasToggleArg(DebuggerClient &client) { + return client.arg(1, "toggle"); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_break.h b/hphp/runtime/eval/debugger/cmd/cmd_break.h index cb77e622c..d252208ce 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_break.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_break.h @@ -30,31 +30,31 @@ public: // Informs the client of all strings that may follow a break command. // Used for auto completion. The client uses the prefix of the argument // following the command to narrow down the list displayed to the user. - virtual void list(DebuggerClient *client); + virtual void list(DebuggerClient &client); // The text to display when the debugger client processes "help break". - virtual void 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 // be accessed via the debugger client API exposed to PHP programs. - virtual void setClientOutput(DebuggerClient *client); + virtual void setClientOutput(DebuggerClient &client); // Updates the breakpoint list in the proxy with the new list // received from the client. Then sends the command back to the // client as confirmation. Returns false if the confirmation message // send failed. - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); // Creates a new CmdBreak instance, sets its breakpoints to the client's // list, sends the command to the server and waits for a response. - static bool SendClientBreakpointListToServer(DebuggerClient *client); + static bool SendClientBreakpointListToServer(DebuggerClient &client); 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 void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); // Serializes this command into the given Thrift buffer. virtual void sendImpl(DebuggerThriftBuffer &thrift); @@ -67,7 +67,7 @@ protected: // to the server so that it too can update it's list. // Returns false if the breakpoint is not well formed. bool addToBreakpointListAndUpdateServer( - DebuggerClient *client, BreakPointInfoPtr bpi, int index); + DebuggerClient &client, BreakPointInfoPtr bpi, int index); private: // Either points to the breakpoint collection of a debugger client @@ -84,34 +84,34 @@ private: // will update its breakpoint list with the one in this command. // The client will block until the server echoes // this command back to it. The echoed command is discarded. - bool updateServer(DebuggerClient *client); + bool updateServer(DebuggerClient &client); // Carries out the "break list" command. - void processList(DebuggerClient *client); + void processList(DebuggerClient &client); // Carries out commands that change the status of a breakpoint. - void 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. // I.e. clear, enable, disable or toggle. - bool hasStatusChangeArg(DebuggerClient *client); + bool hasStatusChangeArg(DebuggerClient &client); // Returns true if the last command parsed by the client has // the string "enable" in its first argument position. - bool hasEnableArg(DebuggerClient *client); + bool hasEnableArg(DebuggerClient &client); // Returns true if the last command parsed by the client has // the string "disable" in its first argument position. - bool hasDisableArg(DebuggerClient *client); + bool hasDisableArg(DebuggerClient &client); // Returns true if the last command parsed by the client has // the string "clear" in its first argument position. - bool hasClearArg(DebuggerClient *client); + bool hasClearArg(DebuggerClient &client); // Returns true if the last command parsed by the client has // the string "toggle" in its first argument position. - bool hasToggleArg(DebuggerClient *client); + bool hasToggleArg(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_complete.cpp b/hphp/runtime/eval/debugger/cmd/cmd_complete.cpp index b181a3141..d471b0cb7 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_complete.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_complete.cpp @@ -30,13 +30,13 @@ void CmdComplete::recvImpl(DebuggerThriftBuffer &thrift) { DebuggerCommand::recvImpl(thrift); } -void CmdComplete::list(DebuggerClient *client) { +void CmdComplete::list(DebuggerClient &client) { } -void CmdComplete::help(DebuggerClient *client) { - client->helpTitle("Copmplete"); - client->help("complete "); - client->helpBody( +void CmdComplete::help(DebuggerClient &client) { + client.helpTitle("Copmplete"); + client.help("complete "); + client.helpBody( "This command provides the same results as TAB completion does on the" " command line, but bypasses the complexity of interacting with the" " readline library. This help is primarily for use by programs that" @@ -44,16 +44,16 @@ void CmdComplete::help(DebuggerClient *client) { ); } -void CmdComplete::onClientImpl(DebuggerClient *client) { +void CmdComplete::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - std::string text = client->lineRest(1); - std::vector res = client->getAllCompletions(text); + std::string text = client.lineRest(1); + std::vector res = client.getAllCompletions(text); for (size_t i = 0; i < res.size(); ++i) { - client->print(res[i].c_str()); + client.print(res[i].c_str()); } } -bool CmdComplete::onServer(DebuggerProxy *proxy) { +bool CmdComplete::onServer(DebuggerProxy &proxy) { assert(false); // this command is processed entirely locally return false; } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_complete.h b/hphp/runtime/eval/debugger/cmd/cmd_complete.h index f98323f4b..291fa20a9 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_complete.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_complete.h @@ -27,13 +27,13 @@ class CmdComplete : public DebuggerCommand { public: CmdComplete() : DebuggerCommand(KindOfComplete) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_config.cpp b/hphp/runtime/eval/debugger/cmd/cmd_config.cpp index 5d1c9ce76..000bdb741 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_config.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_config.cpp @@ -21,39 +21,39 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdConfig::help(DebuggerClient *client) { - client->helpTitle("Config Command"); - client->helpCmds("set ", "set variable to be ", +void CmdConfig::help(DebuggerClient &client) { + client.helpTitle("Config Command"); + client.helpCmds("set ", "set variable to be ", "set", "list current values of variables", nullptr); - client->helpBody( + client.helpBody( "Use this command to set up config variable, " "e.g. turning on/off a special mode." ); } -void CmdConfig::onClientImpl(DebuggerClient *client) { +void CmdConfig::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { + if (client.argCount() == 0) { listVars(client); return; } - std::string var = client->argValue(1); - if (var == "help" || client->argCount() < 2) { + std::string var = client.argValue(1); + if (var == "help" || client.argCount() < 2) { help(client); return; } - std::string value = client->argValue(2); + std::string value = client.argValue(2); if (var == "BypassAccessCheck" || var == "bac") { if (value == "on") { - client->print("BypassAccessCheck(bac) set to on.\n" + client.print("BypassAccessCheck(bac) set to on.\n" "All code executed from debugger is bypassing " "access check!"); - client->setDebuggerBypassCheck(true); + client.setDebuggerBypassCheck(true); } else if (value == "off") { - client->print("BypassAccessCheck(bac) set to off"); - client->setDebuggerBypassCheck(false); + client.print("BypassAccessCheck(bac) set to off"); + client.setDebuggerBypassCheck(false); } else { help(client); } @@ -61,10 +61,10 @@ void CmdConfig::onClientImpl(DebuggerClient *client) { } if (var == "LogFile" || var == "lf") { // Close the current log file handler - FILE *f = client->getLogFileHandler(); + FILE *f = client.getLogFileHandler(); if (f != nullptr) { fclose(f); - client->setLogFileHandler(nullptr); + client.setLogFileHandler(nullptr); } if (value == "off") { @@ -73,36 +73,36 @@ void CmdConfig::onClientImpl(DebuggerClient *client) { // Try open the log file and error if it's not working f = fopen(value.c_str(), "a"); if (f == nullptr) { - client->error("Cannot open log file '%s'", + client.error("Cannot open log file '%s'", value.c_str()); value = ""; - client->setLogFileHandler(nullptr); + client.setLogFileHandler(nullptr); } else { - client->setLogFileHandler(f); + client.setLogFileHandler(f); } } - client->print("LogFile(lf) is set to %s", value == "" ? "off" + client.print("LogFile(lf) is set to %s", value == "" ? "off" : value.c_str()); - client->setLogFile(value); + client.setLogFile(value); 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); + client.error("%d is invalid for PrintLevel(pl)", pl); return; } - client->setDebuggerPrintLevel(pl); - client->print("PrintLevel(pl) is set to %d", pl); + client.setDebuggerPrintLevel(pl); + client.print("PrintLevel(pl) is set to %d", pl); return; } if (var == "SmallStep" || var == "ss") { if (value == "on") { - client->print("SmallStep(ss) set to on.\n"); - client->setDebuggerSmallStep(true); + client.print("SmallStep(ss) set to on.\n"); + client.setDebuggerSmallStep(true); } else if (value == "off") { - client->print("SmallStep(ss) set to off"); - client->setDebuggerSmallStep(false); + client.print("SmallStep(ss) set to off"); + client.setDebuggerSmallStep(false); } else { help(client); } @@ -110,22 +110,22 @@ void CmdConfig::onClientImpl(DebuggerClient *client) { } if (var == "StackArgs" || var == "sa") { if (value == "on") { - client->print("StackArgs(sa) set to on.\n"); - client->setDebuggerStackArgs(true); + client.print("StackArgs(sa) set to on.\n"); + client.setDebuggerStackArgs(true); } else if (value == "off") { - client->print("StackArgs(sa) set to off"); - client->setDebuggerStackArgs(false); + client.print("StackArgs(sa) set to off"); + client.setDebuggerStackArgs(false); } else { help(client); } return; } if (var == "ApiModeSerialize") { - assert(client->isApiMode()); + assert(client.isApiMode()); if (value == "on") { - client->setDebuggerClientApiModeSerialize(true); + client.setDebuggerClientApiModeSerialize(true); } else if (value == "off") { - client->setDebuggerClientApiModeSerialize(false); + client.setDebuggerClientApiModeSerialize(false); } return; } @@ -136,10 +136,10 @@ void CmdConfig::onClientImpl(DebuggerClient *client) { // pointer to the current line). int mcl = strtol(value.c_str(), nullptr, 10); if (mcl < -1) { - client->error("%d is invalid for MaxCodeLines(mcl)", mcl); + client.error("%d is invalid for MaxCodeLines(mcl)", mcl); } 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; } @@ -154,33 +154,33 @@ static const StaticString s_SmallStep("SmallStep"); static const StaticString s_StackArgs("StackArgs"); static const StaticString s_ApiModeSerialize("ApiModeSerialize"); -void CmdConfig::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTValues); +void CmdConfig::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTValues); ArrayInit values(6); - values.set("BypassAccessCheck", client->getDebuggerBypassCheck()); - values.set("LogFile", client->getLogFile()); - values.set("PrintLevel", client->getDebuggerPrintLevel()); - values.set("SmallStep", client->getDebuggerSmallStep()); - values.set("StackArgs", client->getDebuggerStackArgs()); - values.set("ApiModeSerialize", client->getDebuggerClientApiModeSerialize()); - client->setOTValues(values.create()); + values.set("BypassAccessCheck", client.getDebuggerBypassCheck()); + values.set("LogFile", client.getLogFile()); + values.set("PrintLevel", client.getDebuggerPrintLevel()); + values.set("SmallStep", client.getDebuggerSmallStep()); + values.set("StackArgs", client.getDebuggerStackArgs()); + values.set("ApiModeSerialize", client.getDebuggerClientApiModeSerialize()); + client.setOTValues(values.create()); } -void CmdConfig::listVars(DebuggerClient *client) { - std::string LogFile = client->getLogFile(); - client->print("LogFile(lf) %s", LogFile == "" ? +void CmdConfig::listVars(DebuggerClient &client) { + std::string LogFile = client.getLogFile(); + client.print("LogFile(lf) %s", LogFile == "" ? "off" : LogFile.c_str()); - client->print("BypassAccessCheck(bac) %s", - client->getDebuggerBypassCheck() ? "on" : "off"); - client->print("PrintLevel(pl) %d", client->getDebuggerPrintLevel()); - client->print("SmallStep(ss) %s", - client->getDebuggerSmallStep() ? "on" : "off"); - client->print("StackArgs(sa) %s", - client->getDebuggerStackArgs() ? "on" : "off"); - client->print("ApiModeSerialize %s", - client->getDebuggerClientApiModeSerialize() ? "on" : "off"); - client->print("MaxCodeLines(mcl) %d", - client->getDebuggerClientMaxCodeLines()); + client.print("BypassAccessCheck(bac) %s", + client.getDebuggerBypassCheck() ? "on" : "off"); + client.print("PrintLevel(pl) %d", client.getDebuggerPrintLevel()); + client.print("SmallStep(ss) %s", + client.getDebuggerSmallStep() ? "on" : "off"); + client.print("StackArgs(sa) %s", + client.getDebuggerStackArgs() ? "on" : "off"); + client.print("ApiModeSerialize %s", + client.getDebuggerClientApiModeSerialize() ? "on" : "off"); + client.print("MaxCodeLines(mcl) %d", + client.getDebuggerClientMaxCodeLines()); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_config.h b/hphp/runtime/eval/debugger/cmd/cmd_config.h index caaa37370..edcc7297c 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_config.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_config.h @@ -27,13 +27,13 @@ class CmdConfig : public DebuggerCommand { public: CmdConfig() : DebuggerCommand(KindOfConfig) {} - virtual void help(DebuggerClient *client); - virtual void setClientOutput(DebuggerClient *client); + virtual void help(DebuggerClient &client); + virtual void setClientOutput(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); private: - void listVars(DebuggerClient *client); + void listVars(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_constant.cpp b/hphp/runtime/eval/debugger/cmd/cmd_constant.cpp index bb64d0d6f..be04b23e8 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_constant.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_constant.cpp @@ -33,35 +33,35 @@ void CmdConstant::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_constants); } -void CmdConstant::help(DebuggerClient *client) { - client->helpTitle("Constant Command"); - client->helpCmds( +void CmdConstant::help(DebuggerClient &client) { + client.helpTitle("Constant Command"); + client.helpCmds( "[k]onstant", "lists all constants", "[k]onstant {text}", "full-text search constants", nullptr ); - client->helpBody( + client.helpBody( "This will print names and values of all constants, if {text} is not " - "speified. Otherwise, it will print names and values of all constants " + "specified. Otherwise, it will print names and values of all constants " "that contain the text in their names or values. The search is case-" "insensitive and string-based." ); } -void CmdConstant::onClientImpl(DebuggerClient *client) { +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) { + if (client.argCount() == 1) { + text = client.argValue(1); + } else if (client.argCount() != 0) { help(client); return; } - CmdConstantPtr cmd = client->xend(this); + CmdConstantPtr cmd = client.xend(this); if (cmd->m_constants.empty()) { - client->info("(no constant was defined)"); + client.info("(no constant was defined)"); } else { int i = 0; bool found = false; @@ -74,15 +74,15 @@ void CmdConstant::onClientImpl(DebuggerClient *client) { String fullvalue = DebuggerClient::FormatVariable(iter.second(), -1); if (name.find(text, 0, false) >= 0 || fullvalue.find(text, 0, false) >= 0) { - client->print("%s = %s", name.data(), value.data()); + client.print("%s = %s", name.data(), value.data()); found = true; } } else { - client->print("%s = %s", name.data(), value.data()); + client.print("%s = %s", name.data(), value.data()); ++i; - if (!client->isApiMode() && + if (!client.isApiMode() && i % DebuggerClient::ScrollBlockSize == 0 && - client->ask("There are %d more constants. Continue? [Y/n]", + client.ask("There are %d more constants. Continue? [Y/n]", m_constants.size() - i) == 'n') { break; } @@ -90,31 +90,31 @@ void CmdConstant::onClientImpl(DebuggerClient *client) { } if (!text.empty() && !found) { - client->info("(unable to find specified text in any constants)"); + client.info("(unable to find specified text in any constants)"); } } } -void CmdConstant::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTValues); +void CmdConstant::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTValues); Array values; for (ArrayIter iter(m_constants); iter; ++iter) { String name = iter.first().toString(); - if (client->getDebuggerClientApiModeSerialize()) { + if (client.getDebuggerClientApiModeSerialize()) { values.set(name, DebuggerClient::FormatVariable(iter.second(), 200)); } else { values.set(name, iter.second()); } } - client->setOTValues(values); + client.setOTValues(values); } -bool CmdConstant::onServer(DebuggerProxy *proxy) { +bool CmdConstant::onServer(DebuggerProxy &proxy) { try { m_constants = ClassInfo::GetConstants(); } catch (...) {} - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_constant.h b/hphp/runtime/eval/debugger/cmd/cmd_constant.h index 106b326d3..64c9987db 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_constant.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_constant.h @@ -27,13 +27,13 @@ class CmdConstant : public DebuggerCommand { public: CmdConstant() : DebuggerCommand(KindOfConstant) {} - virtual void help(DebuggerClient *client); + virtual void help(DebuggerClient &client); - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_continue.cpp b/hphp/runtime/eval/debugger/cmd/cmd_continue.cpp index eea48bbc5..7f23431b9 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_continue.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_continue.cpp @@ -21,19 +21,19 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdContinue::help(DebuggerClient *client) { - client->helpTitle("Continue Command"); - client->helpCmds( +void CmdContinue::help(DebuggerClient &client) { + client.helpTitle("Continue Command"); + client.helpCmds( "[c]ontinue {count=1}", "continues program execution", nullptr ); - client->helpBody( + client.helpBody( "Use this command at break to resume program execution. Specify a " "count to repeat the same command many times." ); } -void CmdContinue::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdContinue::onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt) { assert(!m_complete); // Complete cmds should not be asked to do work. CmdFlowControl::onSetup(proxy, interrupt); // If there's a remaining count on this cmd then we want it left installed @@ -41,7 +41,7 @@ void CmdContinue::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) { m_complete = (decCount() == 0); } -void CmdContinue::onBeginInterrupt(DebuggerProxy *proxy, +void CmdContinue::onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt) { assert(!m_complete); // Complete cmds should not be asked to do work. m_complete = (decCount() == 0); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_continue.h b/hphp/runtime/eval/debugger/cmd/cmd_continue.h index 08d5dd18e..beb03962f 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_continue.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_continue.h @@ -27,9 +27,9 @@ class CmdContinue : public CmdFlowControl { public: CmdContinue() : CmdFlowControl(KindOfContinue) {} - virtual void help(DebuggerClient *client); - virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt); - virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt); + virtual void help(DebuggerClient &client); + virtual void onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt); + virtual void onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_down.cpp b/hphp/runtime/eval/debugger/cmd/cmd_down.cpp index 2cb222f9d..e6e7ef217 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_down.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_down.cpp @@ -23,31 +23,31 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdDown::help(DebuggerClient *client) { - client->helpTitle("Down Command"); - client->helpCmds( +void CmdDown::help(DebuggerClient &client) { + client.helpTitle("Down Command"); + client.helpCmds( "[d]own {num=1}", "moves to inner frames (callees) on stacktrace", nullptr ); - client->helpBody( + client.helpBody( "Use this command to walk down on stacktrace to find out inner callees of " "current frame. By default it moves down by one level. Specify a number " "to move down several levels a time." ); } -void CmdDown::onClientImpl(DebuggerClient *client) { +void CmdDown::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() > 1) { + if (client.argCount() > 1) { help(client); } else { CmdWhere().fetchStackTrace(client); - client->moveToFrame(client->getFrame() - CmdUp::ParseNumber(client)); + client.moveToFrame(client.getFrame() - CmdUp::ParseNumber(client)); } } -void CmdDown::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTStacktrace); +void CmdDown::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTStacktrace); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_down.h b/hphp/runtime/eval/debugger/cmd/cmd_down.h index dfb6bb81a..30eeeae13 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_down.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_down.h @@ -27,11 +27,11 @@ class CmdDown : public DebuggerCommand { public: CmdDown() : DebuggerCommand(KindOfDown) {} - virtual void help(DebuggerClient *client); - virtual void setClientOutput(DebuggerClient *client); + virtual void help(DebuggerClient &client); + virtual void setClientOutput(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_eval.cpp b/hphp/runtime/eval/debugger/cmd/cmd_eval.cpp index 18cd915f8..68e903636 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_eval.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_eval.cpp @@ -36,14 +36,14 @@ void CmdEval::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_bypassAccessCheck); } -void CmdEval::onClientImpl(DebuggerClient *client) { - m_body = client->getCode(); - m_frame = client->getFrame(); - m_bypassAccessCheck = client->getDebuggerBypassCheck(); - client->sendToServer(this); - DebuggerCommandPtr res = client->recvFromServer(m_type); +void CmdEval::onClientImpl(DebuggerClient &client) { + m_body = client.getCode(); + m_frame = client.getFrame(); + m_bypassAccessCheck = client.getDebuggerBypassCheck(); + client.sendToServer(this); + DebuggerCommandPtr res = client.recvFromServer(m_type); if (!res->is(m_type)) { - assert(client->isApiMode()); + assert(client.isApiMode()); m_incomplete = true; res->setClientOutput(client); } else { @@ -51,30 +51,30 @@ void CmdEval::onClientImpl(DebuggerClient *client) { } } -void CmdEval::handleReply(DebuggerClient *client) { - client->print(m_output); +void CmdEval::handleReply(DebuggerClient &client) { + client.print(m_output); } static const StaticString s_body("body"); static const StaticString s_value("value"); -void CmdEval::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTValues); +void CmdEval::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTValues); ArrayInit values(2); values.set("body", m_body); values.set("value", m_output); - client->setOTValues(values.create()); + client.setOTValues(values.create()); } -bool CmdEval::onServer(DebuggerProxy *proxy) { +bool CmdEval::onServer(DebuggerProxy &proxy) { PCFilter* locSave = g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = new PCFilter(); g_vmContext->setDebuggerBypassCheck(m_bypassAccessCheck); - DebuggerProxy::ExecutePHP(m_body, m_output, !proxy->isLocal(), m_frame); + DebuggerProxy::ExecutePHP(m_body, m_output, !proxy.isLocal(), m_frame); g_vmContext->setDebuggerBypassCheck(false); delete g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = locSave; - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_eval.h b/hphp/runtime/eval/debugger/cmd/cmd_eval.h index de8528419..a2f81e058 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_eval.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_eval.h @@ -27,13 +27,13 @@ class CmdEval : public DebuggerCommand { public: CmdEval() : DebuggerCommand(KindOfEval), m_bypassAccessCheck(false) {} - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); - virtual void handleReply(DebuggerClient *client); + virtual void handleReply(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_example.cpp b/hphp/runtime/eval/debugger/cmd/cmd_example.cpp index ba5f5c15e..b137b1b7d 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_example.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_example.cpp @@ -33,19 +33,19 @@ void CmdExample::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_output); } -void CmdExample::list(DebuggerClient *client) { - client->addCompletion("tic-tac-toe"); - client->addCompletion("hip-hop-roll"); +void CmdExample::list(DebuggerClient &client) { + client.addCompletion("tic-tac-toe"); + client.addCompletion("hip-hop-roll"); } -void CmdExample::help(DebuggerClient *client) { - client->helpTitle("Example Command"); - client->helpCmds( +void CmdExample::help(DebuggerClient &client) { + client.helpTitle("Example Command"); + client.helpCmds( "xample {string}", "it will tell you how long it is!", "x ample {string}", "it will tell you how long it is!", nullptr ); - client->helpBody( + client.helpBody( "This is just an example of extending debugger commands with C++. " "To add a new command, simply run \"php new_cmd.php {name}\" under " "runtime/eval/debugger/cmd, and it will generate two files to start with. " @@ -54,21 +54,21 @@ void CmdExample::help(DebuggerClient *client) { ); } -void CmdExample::onClientImpl(DebuggerClient *client) { +void CmdExample::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 1) { + if (client.argCount() == 1) { help(client); return; } - m_input = client->lineRest(2); - CmdExamplePtr res = client->xend(this); - client->output("%d", res->m_output); + m_input = client.lineRest(2); + CmdExamplePtr res = client.xend(this); + client.output("%d", res->m_output); } -bool CmdExample::onServer(DebuggerProxy *proxy) { +bool CmdExample::onServer(DebuggerProxy &proxy) { m_output = m_input.size(); - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_example.h b/hphp/runtime/eval/debugger/cmd/cmd_example.h index 4f26c591c..9ec66f696 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_example.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_example.h @@ -25,13 +25,13 @@ namespace HPHP { namespace Eval { DECLARE_BOOST_TYPES(CmdExample); class CmdExample : public CmdExtended { public: - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_exception.cpp b/hphp/runtime/eval/debugger/cmd/cmd_exception.cpp index bdb8b1c1a..e36321075 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_exception.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_exception.cpp @@ -21,22 +21,22 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdException::list(DebuggerClient *client) { - if (client->argCount() == 0) { - client->addCompletion(DebuggerClient::AutoCompleteClasses); - client->addCompletion("error"); - client->addCompletion("regex"); - client->addCompletion("once"); - } else if (client->arg(1, "regex") || client->arg(1, "once")) { - client->addCompletion(DebuggerClient::AutoCompleteClasses); +void CmdException::list(DebuggerClient &client) { + if (client.argCount() == 0) { + client.addCompletion(DebuggerClient::AutoCompleteClasses); + client.addCompletion("error"); + client.addCompletion("regex"); + client.addCompletion("once"); + } else if (client.arg(1, "regex") || client.arg(1, "once")) { + client.addCompletion(DebuggerClient::AutoCompleteClasses); } else { - client->addCompletion(DebuggerClient::AutoCompleteCode); + client.addCompletion(DebuggerClient::AutoCompleteCode); } } -void CmdException::help(DebuggerClient *client) { - client->helpTitle("Exception Command"); - client->helpCmds( +void CmdException::help(DebuggerClient &client) { + client.helpTitle("Exception Command"); + client.helpCmds( "[e]xception {cls}", "breaks if class of exception throws", "[e]xception {ns}::{cls}", "breaks if class of exception throws", "[e]xception error", "breaks on errors, warnings and notices", @@ -49,7 +49,7 @@ void CmdException::help(DebuggerClient *client) { "[e]xception {above} && {php}", "breaks and evaluates an expression", nullptr ); - client->helpBody( + client.helpBody( "Exception command is similar to '[b]reak' command, except it's used " "to specify how to break on (or catch) a throw of an exception. Program " "stops right before the exception is about to throw. Resuming program " @@ -66,9 +66,9 @@ void CmdException::help(DebuggerClient *client) { ); } -void CmdException::onClientImpl(DebuggerClient *client) { +void CmdException::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { + if (client.argCount() == 0) { help(client); return; } @@ -77,18 +77,18 @@ void CmdException::onClientImpl(DebuggerClient *client) { BreakPointInfo::State state = BreakPointInfo::Always; int index = 1; - if (client->arg(1, "regex")) { + if (client.arg(1, "regex")) { regex = true; index++; - } else if (client->arg(1, "once")) { + } else if (client.arg(1, "once")) { state = BreakPointInfo::Once; index++; } BreakPointInfoPtr bpi(new BreakPointInfo(regex, state, ExceptionThrown, - client->argValue(index), "")); + client.argValue(index), "")); if (!addToBreakpointListAndUpdateServer(client, bpi, index)) { - client->tutorial( + client.tutorial( "This is the order of different arguments:\n" "\n" "\t[e]xception [r]egex|[o]nce {exp} if|&& {php}\n" @@ -102,7 +102,7 @@ void CmdException::onClientImpl(DebuggerClient *client) { } } -void CmdException::setClientOutput(DebuggerClient *client) { +void CmdException::setClientOutput(DebuggerClient &client) { // Also output an array of all breakpoints which include exceptions CmdBreak().setClientOutput(client); } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_exception.h b/hphp/runtime/eval/debugger/cmd/cmd_exception.h index 1343a3a6a..165217817 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_exception.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_exception.h @@ -29,12 +29,12 @@ public: m_type = KindOfException; } - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); - virtual void setClientOutput(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); + virtual void setClientOutput(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_extended.cpp b/hphp/runtime/eval/debugger/cmd/cmd_extended.cpp index 0d8623853..ebd5de4eb 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_extended.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_extended.cpp @@ -23,12 +23,12 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdExtended::list(DebuggerClient *client) { - if (client->argCount() == 0) { +void CmdExtended::list(DebuggerClient &client) { + if (client.argCount() == 0) { const ExtendedCommandMap &cmds = getCommandMap(); for (ExtendedCommandMap::const_iterator iter = cmds.begin(); iter != cmds.end(); ++iter) { - client->addCompletion(iter->first.c_str()); + client.addCompletion(iter->first.c_str()); } } else { ExtendedCommandMap matches = match(client, 1); @@ -47,53 +47,53 @@ static string format_unique_prefix(const std::string &cmd, return "[" + cmd.substr(0, i) + "]" + cmd.substr(i); } } - return cmd + " (ambigulously bad command)"; + return cmd + " (ambiguous command)"; } -void CmdExtended::helpImpl(DebuggerClient *client, const char *name) { +void CmdExtended::helpImpl(DebuggerClient &client, const char *name) { const char *cmd = "{cmd} {arg1} {arg2} ..."; const char *help = "invoke specified command"; - client->helpCmds((string(name) + " " + cmd).c_str(), help, + client.helpCmds((string(name) + " " + cmd).c_str(), help, (string(name) + cmd).c_str(), help, nullptr); const ExtendedCommandMap &cmds = getCommandMap(); if (!cmds.empty()) { - client->help(""); - client->help("where {cmd} can be:"); - client->help(""); + client.help(""); + client.help("where {cmd} can be:"); + client.help(""); vector vcmds; for (ExtendedCommandMap::const_iterator iter = cmds.begin(); iter != cmds.end(); ++iter) { vcmds.push_back(iter->first); } for (unsigned int i = 0; i < vcmds.size(); i++) { - client->help("\t%s", format_unique_prefix + client.help("\t%s", format_unique_prefix (vcmds[i], i ? vcmds[i-1] : "", i < vcmds.size() - 1 ? vcmds[i+1] : "").c_str()); } - client->help(""); - client->help("Type '%s [h]elp|? {cmd} to read their usages.", name); + client.help(""); + client.help("Type '%s [h]elp|? {cmd} to read their usages.", name); } } -ExtendedCommandMap CmdExtended::match(DebuggerClient *client, int argIndex) { +ExtendedCommandMap CmdExtended::match(DebuggerClient &client, int argIndex) { ExtendedCommandMap matches; const ExtendedCommandMap &cmds = getCommandMap(); for (ExtendedCommandMap::const_iterator iter = cmds.begin(); iter != cmds.end(); ++iter) { - if (client->arg(argIndex, iter->first.c_str())) { + if (client.arg(argIndex, iter->first.c_str())) { matches[iter->first] = iter->second; } } if (matches.empty()) { - client->error("Cannot find the specified user command: %s", - client->argValue(argIndex).c_str()); + client.error("Cannot find the specified user command: %s", + client.argValue(argIndex).c_str()); } return matches; } -void CmdExtended::helpCommands(DebuggerClient *client, +void CmdExtended::helpCommands(DebuggerClient &client, const ExtendedCommandMap &matches) { for (ExtendedCommandMap::const_iterator iter = matches.begin(); iter != matches.end(); ++iter) { @@ -101,9 +101,9 @@ void CmdExtended::helpCommands(DebuggerClient *client, } } -void CmdExtended::onClientImpl(DebuggerClient *client) { - if (client->arg(1, "help") || client->arg(1, "?")) { - if (client->argCount() == 1) { +void CmdExtended::onClientImpl(DebuggerClient &client) { + if (client.arg(1, "help") || client.arg(1, "?")) { + if (client.argCount() == 1) { help(client); return; } @@ -120,13 +120,13 @@ void CmdExtended::onClientImpl(DebuggerClient *client) { if (matches.empty()) { help(client); } else if (matches.size() > 1) { - client->error("Need more letters to tell which one of these:"); + 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()); + client.error("\t%s", iter->first.c_str()); } } else if (!invokeClient(client, matches.begin()->second)) { - if (client->arg(2, "help") || client->arg(2, "?")) { + if (client.arg(2, "help") || client.arg(2, "?")) { helpCommands(client, matches); } } @@ -134,8 +134,8 @@ void CmdExtended::onClientImpl(DebuggerClient *client) { /////////////////////////////////////////////////////////////////////////////// -void CmdExtended::help(DebuggerClient *client) { - client->helpTitle("Extended Command"); +void CmdExtended::help(DebuggerClient &client) { + client.helpTitle("Extended Command"); helpImpl(client, "x"); } @@ -143,14 +143,14 @@ const ExtendedCommandMap &CmdExtended::getCommandMap() { return GetExtendedCommandMap(); } -void CmdExtended::invokeList(DebuggerClient *client, const std::string &cls){ +void CmdExtended::invokeList(DebuggerClient &client, const std::string &cls){ DebuggerCommandPtr cmd = CreateExtendedCommand(cls); if (cmd) { cmd->list(client); } } -bool CmdExtended::invokeHelp(DebuggerClient *client, const std::string &cls) { +bool CmdExtended::invokeHelp(DebuggerClient &client, const std::string &cls) { DebuggerCommandPtr cmd = CreateExtendedCommand(cls); if (cmd) { cmd->help(client); @@ -159,7 +159,7 @@ bool CmdExtended::invokeHelp(DebuggerClient *client, const std::string &cls) { return false; } -bool CmdExtended::invokeClient(DebuggerClient *client, const std::string &cls){ +bool CmdExtended::invokeClient(DebuggerClient &client, const std::string &cls){ DebuggerCommandPtr cmd = CreateExtendedCommand(cls); if (cmd) { cmd->onClient(client); @@ -168,7 +168,7 @@ bool CmdExtended::invokeClient(DebuggerClient *client, const std::string &cls){ return false; } -bool CmdExtended::onServer(DebuggerProxy *proxy) { +bool CmdExtended::onServer(DebuggerProxy &proxy) { assert(false); return false; } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_extended.h b/hphp/runtime/eval/debugger/cmd/cmd_extended.h index c5f6d56c9..725174edb 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_extended.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_extended.h @@ -34,24 +34,24 @@ public: public: CmdExtended() : DebuggerCommand(KindOfExtended) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); // so CmdUser can override these functions virtual const ExtendedCommandMap &getCommandMap(); - virtual void invokeList(DebuggerClient *client, const std::string &cls); - virtual bool invokeHelp(DebuggerClient *client, const std::string &cls); - virtual bool invokeClient(DebuggerClient *client, const std::string &cls); + virtual void invokeList(DebuggerClient &client, const std::string &cls); + virtual bool invokeHelp(DebuggerClient &client, const std::string &cls); + virtual bool invokeClient(DebuggerClient &client, const std::string &cls); protected: - virtual void onClientImpl(DebuggerClient *client); - void helpImpl(DebuggerClient *client, const char *name); + virtual void onClientImpl(DebuggerClient &client); + void helpImpl(DebuggerClient &client, const char *name); private: - ExtendedCommandMap match(DebuggerClient *client, int argIndex); - void helpCommands(DebuggerClient *client, const ExtendedCommandMap &matches); + ExtendedCommandMap match(DebuggerClient &client, int argIndex); + void helpCommands(DebuggerClient &client, const ExtendedCommandMap &matches); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_extension.cpp b/hphp/runtime/eval/debugger/cmd/cmd_extension.cpp index d8b9ce086..e56dc21a3 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_extension.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_extension.cpp @@ -39,11 +39,11 @@ void CmdExtension::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_err); } -void CmdExtension::list(DebuggerClient *client) { - if (client->argCount() == 2) { - client->addCompletion("dump"); - } else if (client->argCount() > 2) { - client->addCompletion(DebuggerClient::AutoCompleteFileNames); +void CmdExtension::list(DebuggerClient &client) { + if (client.argCount() == 2) { + client.addCompletion("dump"); + } else if (client.argCount() > 2) { + client.addCompletion(DebuggerClient::AutoCompleteFileNames); } else { // This is cheating, assuming server has same list of extensions. Array exts = Extension::GetLoadedExtensions(); @@ -51,20 +51,20 @@ void CmdExtension::list(DebuggerClient *client) { for (ArrayIter iter(exts); iter; ++iter) { items.push_back(iter.second().toString()->toCPPString()); } - client->addCompletion(items); + client.addCompletion(items); } } -void CmdExtension::help(DebuggerClient *client) { - client->helpTitle("Extension Command"); - client->helpCmds( +void CmdExtension::help(DebuggerClient &client) { + client.helpTitle("Extension Command"); + client.helpCmds( "x [t]ension", "lists all extensions", "x [t]ension {name}", "shows summary info of the extension", "x [t]ension {name} dump", "shows detailed info of the extension", "x [t]ension {name} {verb} {args} ...", "executes an action", nullptr ); - client->helpBody( + client.helpBody( "In PHP, a lot of library functions are implemented as \"extensions\". " "This command allows extensions to support debugger by providing their " "version numbers, current status and cached data and by providing " @@ -72,18 +72,18 @@ void CmdExtension::help(DebuggerClient *client) { ); } -void CmdExtension::onClientImpl(DebuggerClient *client) { +void CmdExtension::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - m_args = *client->args(); - CmdExtensionPtr cmd = client->xend(this); + m_args = *client.args(); + CmdExtensionPtr cmd = client.xend(this); if (cmd->m_out.empty()) { - client->error(cmd->m_err); + client.error(cmd->m_err); } else { - client->print(cmd->m_out); + client.print(cmd->m_out); } } -bool CmdExtension::processList(DebuggerProxy *proxy) { +bool CmdExtension::processList(DebuggerProxy &proxy) { IDebuggable::InfoVec info; Array exts = Extension::GetLoadedExtensions(); @@ -120,10 +120,10 @@ bool CmdExtension::processList(DebuggerProxy *proxy) { for (int i = 0; i < hrLen; i++) sb.append(BOX_H); sb.append("\n"); m_out = sb.detach(); - return proxy->sendToClient(this); + return proxy.sendToClient(this); } -bool CmdExtension::onServer(DebuggerProxy *proxy) { +bool CmdExtension::onServer(DebuggerProxy &proxy) { if (m_args.size() <= 1) { return processList(proxy); } @@ -163,7 +163,7 @@ bool CmdExtension::onServer(DebuggerProxy *proxy) { m_err = "Unable to find the specified extension: "; m_err += String(name); } - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_extension.h b/hphp/runtime/eval/debugger/cmd/cmd_extension.h index c9ba12e87..fbb94f3c0 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_extension.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_extension.h @@ -25,13 +25,13 @@ namespace HPHP { namespace Eval { DECLARE_BOOST_TYPES(CmdExtension); class CmdExtension : public CmdExtended { public: - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); @@ -40,7 +40,7 @@ private: String m_out; String m_err; - bool processList(DebuggerProxy *proxy); + bool processList(DebuggerProxy &proxy); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_flow_control.cpp b/hphp/runtime/eval/debugger/cmd/cmd_flow_control.cpp index 10158b3f4..d163d09ca 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_flow_control.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_flow_control.cpp @@ -39,41 +39,41 @@ void CmdFlowControl::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_smallStep); } -void CmdFlowControl::onClientImpl(DebuggerClient *client) { +void CmdFlowControl::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - client->setFrame(0); + client.setFrame(0); - if (client->argCount() > 1) { + if (client.argCount() > 1) { help(client); return; } - if (client->argCount() == 1) { - string snum = client->argValue(1); + if (client.argCount() == 1) { + string snum = client.argValue(1); if (!DebuggerClient::IsValidNumber(snum)) { - client->error("Count needs to be a number."); + client.error("Count needs to be a number."); return; } m_count = atoi(snum.c_str()); if (m_count < 1) { - client->error("Count needs to be a positive number."); + client.error("Count needs to be a positive number."); return; } } - m_smallStep = client->getDebuggerSmallStep(); - client->sendToServer(this); + m_smallStep = client.getDebuggerSmallStep(); + client.sendToServer(this); throw DebuggerConsoleExitException(); } -bool CmdFlowControl::onServer(DebuggerProxy *proxy) { +bool CmdFlowControl::onServer(DebuggerProxy &proxy) { // Flow control cmds do their work in onSetup() and onBeginInterrupt(), so // there is no real work to do in here. return true; } -void CmdFlowControl::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdFlowControl::onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt) { // Should only do setting and nothing else g_context->setDebuggerSmallStep(m_smallStep); } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_flow_control.h b/hphp/runtime/eval/debugger/cmd/cmd_flow_control.h index 660bc9606..9188ea630 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_flow_control.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_flow_control.h @@ -47,13 +47,13 @@ public: m_count(1) { } virtual ~CmdFlowControl(); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); // Work done to setup a new flow command, after receiving it from the client. - virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt); + virtual void onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt); // Work done when a VM thread interrupts the proxy. - virtual void onBeginInterrupt(DebuggerProxy *proxy, + virtual void onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt) = 0; // A completed flow cmd has done all its work and can be deleted. @@ -63,7 +63,7 @@ public: bool needsVMInterrupt() { return m_needsVMInterrupt; } protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_frame.cpp b/hphp/runtime/eval/debugger/cmd/cmd_frame.cpp index 1cca84d93..90b761c22 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_frame.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_frame.cpp @@ -23,31 +23,31 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdFrame::help(DebuggerClient *client) { - client->helpTitle("Frame Command"); - client->helpCmds( +void CmdFrame::help(DebuggerClient &client) { + client.helpTitle("Frame Command"); + client.helpCmds( "[f]rame {index}", "jumps to one particular frame", nullptr ); - client->helpBody( + client.helpBody( "Use '[w]here' command to find out the frame number. Use 'f 0' to jump " "back to the most recent frame or the innermost frame. Use 'f 999' or " "some big number to jump to the outermost frame." ); } -void CmdFrame::onClientImpl(DebuggerClient *client) { +void CmdFrame::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() != 1) { + if (client.argCount() != 1) { help(client); } else { CmdWhere().fetchStackTrace(client); - client->moveToFrame(CmdUp::ParseNumber(client)); + client.moveToFrame(CmdUp::ParseNumber(client)); } } -void CmdFrame::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTStacktrace); +void CmdFrame::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTStacktrace); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_frame.h b/hphp/runtime/eval/debugger/cmd/cmd_frame.h index 23e484a0b..20c3b650b 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_frame.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_frame.h @@ -27,11 +27,11 @@ class CmdFrame : public DebuggerCommand { public: CmdFrame() : DebuggerCommand(KindOfFrame) {} - virtual void help(DebuggerClient *client); - virtual void setClientOutput(DebuggerClient *client); + virtual void help(DebuggerClient &client); + virtual void setClientOutput(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_global.cpp b/hphp/runtime/eval/debugger/cmd/cmd_global.cpp index 06ec15412..913f6cf20 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_global.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_global.cpp @@ -32,14 +32,14 @@ void CmdGlobal::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_globals); } -void CmdGlobal::help(DebuggerClient *client) { - client->helpTitle("Global Command"); - client->helpCmds( +void CmdGlobal::help(DebuggerClient &client) { + client.helpTitle("Global Command"); + client.helpCmds( "[g]lobal", "lists all global variables", "[g]lobal {text}", "full-text search global variables", nullptr ); - client->helpBody( + client.helpBody( "This will print names and values of all global variables, if {text} is " "not speified. Otherwise, it will print global variables that contain the " "text in their names or values. The search is case-insensitive and " @@ -47,44 +47,44 @@ void CmdGlobal::help(DebuggerClient *client) { ); } -void CmdGlobal::onClientImpl(DebuggerClient *client) { +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) { + if (client.argCount() == 1) { + text = client.argValue(1); + } else if (client.argCount() != 0) { help(client); return; } - CmdGlobalPtr cmd = client->xend(this); + CmdGlobalPtr cmd = client.xend(this); if (cmd->m_globals.empty()) { - client->info("(no global variable was found)"); + client.info("(no global variable was found)"); } else { m_globals = cmd->m_globals; CmdVariable::PrintVariables(client, cmd->m_globals, true, text); } } -void CmdGlobal::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTValues); +void CmdGlobal::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTValues); Array values; for (ArrayIter iter(m_globals); iter; ++iter) { String name = iter.first().toString(); - if (client->getDebuggerClientApiModeSerialize()) { + if (client.getDebuggerClientApiModeSerialize()) { values.set(name, DebuggerClient::FormatVariable(iter.second(), 200)); } else { values.set(name, iter.second()); } } - client->setOTValues(values); + client.setOTValues(values); } -bool CmdGlobal::onServer(DebuggerProxy *proxy) { +bool CmdGlobal::onServer(DebuggerProxy &proxy) { m_globals = CmdVariable::GetGlobalVariables(); - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_global.h b/hphp/runtime/eval/debugger/cmd/cmd_global.h index bc7d083a2..7be152b74 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_global.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_global.h @@ -27,13 +27,13 @@ class CmdGlobal : public DebuggerCommand { public: CmdGlobal() : DebuggerCommand(KindOfGlobal) {} - virtual void help(DebuggerClient *client); + virtual void help(DebuggerClient &client); - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_help.cpp b/hphp/runtime/eval/debugger/cmd/cmd_help.cpp index 952dd2fce..127e53d98 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_help.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_help.cpp @@ -21,8 +21,8 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdHelp::HelpAll(DebuggerClient *client) { - client->helpCmds( +void CmdHelp::HelpAll(DebuggerClient &client) { + client.helpCmds( "Session Commands", "", "[m]achine", "connects to an HHVM server", "[t]hread", "switches between different threads", @@ -72,14 +72,14 @@ void CmdHelp::HelpAll(DebuggerClient *client) { nullptr ); - client->helpBody("* These commands are replayable by just hitting return.\n" + client.helpBody("* These commands are replayable by just hitting return.\n" "** Type \"help help\" to get more help."); } -void CmdHelp::HelpStarted(DebuggerClient *client) { - client->helpTitle("Getting Started with Debugger"); +void CmdHelp::HelpStarted(DebuggerClient &client) { + client.helpTitle("Getting Started with Debugger"); - client->helpBody( + client.helpBody( "1. Quick Overview\n" "\n" "(1) from A to Z\n" @@ -117,7 +117,7 @@ void CmdHelp::HelpStarted(DebuggerClient *client) { "documentation]] for more details." ); - client->helpBody( + client.helpBody( "2. Debugging local script\n" "\n" "The command to run a script normally looks like this,\n" @@ -169,7 +169,7 @@ void CmdHelp::HelpStarted(DebuggerClient *client) { " hphpd> quit" ); - client->helpBody( + client.helpBody( "3. Debugging sandbox\n" "\n" "Connect to an HHVM server from command line,\n" @@ -196,7 +196,7 @@ void CmdHelp::HelpStarted(DebuggerClient *client) { "shared by all of them." ); - client->helpBody( + client.helpBody( "4. Understanding dummy sandbox\n" "\n" "When a web request hits a breakpoint, debugger will run in a " @@ -228,7 +228,7 @@ void CmdHelp::HelpStarted(DebuggerClient *client) { " Ctrl-C" ); - client->helpBody( + client.helpBody( "5. Colors and Configuration\n" "\n" "By default, it will use emacs colors for dark background. To change " @@ -244,26 +244,26 @@ void CmdHelp::HelpStarted(DebuggerClient *client) { ); } -void CmdHelp::list(DebuggerClient *client) { - if (client->argCount() == 0) { - client->addCompletion(DebuggerClient::GetCommands()); - client->addCompletion("tutorial"); - client->addCompletion("start"); - } else if (client->arg(1, "tutorial")) { - client->addCompletion("on"); - client->addCompletion("off"); - client->addCompletion("auto"); +void CmdHelp::list(DebuggerClient &client) { + if (client.argCount() == 0) { + client.addCompletion(DebuggerClient::GetCommands()); + client.addCompletion("tutorial"); + client.addCompletion("start"); + } else if (client.arg(1, "tutorial")) { + client.addCompletion("on"); + client.addCompletion("off"); + client.addCompletion("auto"); } } -void CmdHelp::help(DebuggerClient *client) { - client->helpTitle("Help Command"); - client->helpCmds( +void CmdHelp::help(DebuggerClient &client) { + client.helpTitle("Help Command"); + client.helpCmds( "[h]elp [s]tart", "displays material for getting started", "[h]elp [t]utorial on|off|auto", "changing tutorial modes", nullptr ); - client->helpBody( + client.helpBody( "Please read \"Getting Started\" material with '[h]elp [s]tart' for " "first time use to get yourself familiar with basics.\n" "\n" @@ -277,32 +277,32 @@ void CmdHelp::help(DebuggerClient *client) { ); } -void CmdHelp::onClientImpl(DebuggerClient *client) { +void CmdHelp::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { + if (client.argCount() == 0) { HelpAll(client); - } else if (client->arg(1, "start")) { + } else if (client.arg(1, "start")) { HelpStarted(client); - } else if (client->arg(1, "tutorial")) { + } else if (client.arg(1, "tutorial")) { if (!processTutorial(client)) { help(client); } } else { - client->swapHelp(); - if (!client->process()) { + client.swapHelp(); + if (!client.process()) { help(client); } } } -bool CmdHelp::processTutorial(DebuggerClient *client) { - string mode = client->argValue(2); +bool CmdHelp::processTutorial(DebuggerClient &client) { + string mode = client.argValue(2); if (mode == "off") { - client->setTutorial(-1); + client.setTutorial(-1); } else if (mode == "on") { - client->setTutorial(1); + client.setTutorial(1); } else if (mode == "auto") { - client->setTutorial(0); + client.setTutorial(0); } else { return false; } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_help.h b/hphp/runtime/eval/debugger/cmd/cmd_help.h index 96c29653a..c7a824222 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_help.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_help.h @@ -25,20 +25,20 @@ namespace HPHP { namespace Eval { DECLARE_BOOST_TYPES(CmdHelp); class CmdHelp : public DebuggerCommand { public: - static void HelpAll(DebuggerClient *client); - static void HelpStarted(DebuggerClient *client); + static void HelpAll(DebuggerClient &client); + static void HelpStarted(DebuggerClient &client); public: CmdHelp() : DebuggerCommand(KindOfHelp) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); private: - bool processTutorial(DebuggerClient *client); + bool processTutorial(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_info.cpp b/hphp/runtime/eval/debugger/cmd/cmd_info.cpp index dac76da12..bc7c02fb1 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_info.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_info.cpp @@ -89,17 +89,17 @@ void CmdInfo::recvImpl(DebuggerThriftBuffer &thrift) { } } -void CmdInfo::list(DebuggerClient *client) { - client->addCompletion(DebuggerClient::AutoCompleteFunctions); - client->addCompletion(DebuggerClient::AutoCompleteClasses); - client->addCompletion(DebuggerClient::AutoCompleteClassMethods); - client->addCompletion(DebuggerClient::AutoCompleteClassProperties); - client->addCompletion(DebuggerClient::AutoCompleteClassConstants); +void CmdInfo::list(DebuggerClient &client) { + client.addCompletion(DebuggerClient::AutoCompleteFunctions); + client.addCompletion(DebuggerClient::AutoCompleteClasses); + client.addCompletion(DebuggerClient::AutoCompleteClassMethods); + client.addCompletion(DebuggerClient::AutoCompleteClassProperties); + client.addCompletion(DebuggerClient::AutoCompleteClassConstants); } -void CmdInfo::help(DebuggerClient *client) { - client->helpTitle("Info Command"); - client->helpCmds( +void CmdInfo::help(DebuggerClient &client) { + client.helpTitle("Info Command"); + client.helpCmds( "info", "displays current function's info", "info {cls}", "displays declaration of this class", "info {function}", "displays declaration of this function", @@ -108,14 +108,14 @@ void CmdInfo::help(DebuggerClient *client) { "info {cls::$property}", "displays declaration of this property", nullptr ); - client->helpBody( + client.helpBody( "Use this command to display declaration of a symbol." ); } -bool CmdInfo::parseZeroArg(DebuggerClient *client) { - assert(client->argCount() == 0); - BreakPointInfoPtr bpi = client->getCurrentLocation(); +bool CmdInfo::parseZeroArg(DebuggerClient &client) { + assert(client.argCount() == 0); + BreakPointInfoPtr bpi = client.getCurrentLocation(); if (bpi) { m_symbol = bpi->getClass(); m_type = KindOfClass; @@ -127,9 +127,9 @@ bool CmdInfo::parseZeroArg(DebuggerClient *client) { return !m_symbol.empty(); } -void CmdInfo::parseOneArg(DebuggerClient *client, string &subsymbol) { - assert(client->argCount() == 1); - string symbol = client->argValue(1); +void CmdInfo::parseOneArg(DebuggerClient &client, string &subsymbol) { + assert(client.argCount() == 1); + string symbol = client.argValue(1); size_t pos = symbol.find("::"); if (pos != string::npos) { m_symbol = String(symbol.substr(0, pos)); @@ -144,49 +144,49 @@ void CmdInfo::parseOneArg(DebuggerClient *client, string &subsymbol) { } } -void CmdInfo::onClientImpl(DebuggerClient *client) { +void CmdInfo::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; string subsymbol; - if (client->argCount() == 0) { + if (client.argCount() == 0) { if (!parseZeroArg(client)) { - client->error("There is no current function or method to look up."); - client->tutorial( + client.error("There is no current function or method to look up."); + client.tutorial( "You can only use '[i]nfo' without a symbol name when you are running " "your program and it breaks at a function or a class method. It will " "then look up information about that function or method." ); return; } - } else if (client->argCount() == 1) { + } else if (client.argCount() == 1) { parseOneArg(client, subsymbol); } else { help(client); return; } - CmdInfoPtr cmd = client->xend(this); + CmdInfoPtr cmd = client.xend(this); Array info = cmd->m_info; if (info.empty()) { - client->info("(specified symbol cannot be found)"); + client.info("(specified symbol cannot be found)"); } else { for (ArrayIter iter(info); iter; ++iter) { StringBuffer sb; PrintInfo(client, sb, iter.second(), subsymbol); - client->code(sb.detach()); + client.code(sb.detach()); } } } -void CmdInfo::UpdateLiveLists(DebuggerClient *client) { +void CmdInfo::UpdateLiveLists(DebuggerClient &client) { CmdInfo cmd; cmd.m_type = KindOfLiveLists; - CmdInfoPtr res = client->xend(&cmd); - client->setLiveLists(res->m_acLiveLists); + CmdInfoPtr res = client.xend(&cmd); + client.setLiveLists(res->m_acLiveLists); } -String CmdInfo::GetProtoType(DebuggerClient *client, const std::string &cls, +String CmdInfo::GetProtoType(DebuggerClient &client, const std::string &cls, const std::string &func) { CmdInfo cmd; cmd.m_type = KindOfFunction; @@ -195,7 +195,7 @@ String CmdInfo::GetProtoType(DebuggerClient *client, const std::string &cls, } else { cmd.m_symbol = String(cls) + "::" + String(func); } - CmdInfoPtr res = client->xend(&cmd); + CmdInfoPtr res = client.xend(&cmd); Array info = res->m_info; if (!info.empty()) { info = info[0]; @@ -211,7 +211,7 @@ String CmdInfo::GetProtoType(DebuggerClient *client, const std::string &cls, return String(); } -bool CmdInfo::onServer(DebuggerProxy *proxy) { +bool CmdInfo::onServer(DebuggerProxy &proxy) { if (m_type == KindOfLiveLists) { std::vector tmpAcLiveLists[DebuggerClient::AutoCompleteCount]; m_acLiveLists = DebuggerClient::CreateNewLiveLists(); @@ -254,7 +254,7 @@ bool CmdInfo::onServer(DebuggerProxy *proxy) { vars.push_back("$" + iter.first().toString()->toCPPString()); } - return proxy->sendToClient(this); + return proxy.sendToClient(this); } if (m_type == KindOfUnknown || m_type == KindOfClass) { @@ -273,7 +273,7 @@ bool CmdInfo::onServer(DebuggerProxy *proxy) { } } catch (...) {} } - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// @@ -296,7 +296,7 @@ void CmdInfo::PrintDocComments(StringBuffer &sb, CArrRef info) { } } -void CmdInfo::PrintHeader(DebuggerClient *client, StringBuffer &sb, +void CmdInfo::PrintHeader(DebuggerClient &client, StringBuffer &sb, CArrRef info) { if (!info[s_internal].toBoolean()) { String file = info[s_file].toString(); @@ -309,11 +309,11 @@ void CmdInfo::PrintHeader(DebuggerClient *client, StringBuffer &sb, } else if (line1 && line2 && line1 != line2) { sb.printf("// defined on line %d to %d of %s\n", line1, line2, file.data()); - client->setListLocation(file.data(), line1 - 1, false); + client.setListLocation(file.data(), line1 - 1, false); } else { int line = line1 ? line1 : line2; sb.printf("// defined on line %d of %s\n", line, file.data()); - client->setListLocation(file.data(), line - 1, false); + client.setListLocation(file.data(), line - 1, false); } } @@ -421,7 +421,7 @@ bool CmdInfo::TryProperty(StringBuffer &sb, CArrRef info, return false; } -bool CmdInfo::TryMethod(DebuggerClient *client, StringBuffer &sb, CArrRef info, +bool CmdInfo::TryMethod(DebuggerClient &client, StringBuffer &sb, CArrRef info, std::string subsymbol) { if (subsymbol.size() > 2 && subsymbol.substr(subsymbol.size() - 2) == "()") { subsymbol = subsymbol.substr(0, subsymbol.size() - 2); @@ -445,7 +445,7 @@ bool CmdInfo::TryMethod(DebuggerClient *client, StringBuffer &sb, CArrRef info, return false; } -void CmdInfo::PrintInfo(DebuggerClient *client, StringBuffer &sb, CArrRef info, +void CmdInfo::PrintInfo(DebuggerClient &client, StringBuffer &sb, CArrRef info, const std::string &subsymbol) { if (info.exists(s_params)) { PrintHeader(client, sb, info); @@ -462,7 +462,7 @@ void CmdInfo::PrintInfo(DebuggerClient *client, StringBuffer &sb, CArrRef info, if (TryProperty(sb, info, subsymbol)) found = true; if (TryMethod(client, sb, info, subsymbol)) found = true; if (found) return; - client->info("Specified symbol cannot be found. Here the whole class:\n"); + client.info("Specified symbol cannot be found. Here the whole class:\n"); } PrintHeader(client, sb, info); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_info.h b/hphp/runtime/eval/debugger/cmd/cmd_info.h index 2a55944b8..f3ce6ddf2 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_info.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_info.h @@ -25,25 +25,25 @@ namespace HPHP { namespace Eval { DECLARE_BOOST_TYPES(CmdInfo); class CmdInfo : public DebuggerCommand { public: - static void UpdateLiveLists(DebuggerClient *client); - static String GetProtoType(DebuggerClient *client, const std::string &cls, + static void UpdateLiveLists(DebuggerClient &client); + static String GetProtoType(DebuggerClient &client, const std::string &cls, const std::string &func); public: CmdInfo() : DebuggerCommand(KindOfInfo) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); - bool parseZeroArg(DebuggerClient *client); - void parseOneArg(DebuggerClient *client, std::string &subsymbol); + bool parseZeroArg(DebuggerClient &client); + void parseOneArg(DebuggerClient &client, std::string &subsymbol); Array getInfo() { return m_info; } static String FindSubSymbol(CArrRef symbols, const std::string &symbol); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); @@ -68,13 +68,13 @@ private: const std::string &subsymbol); static bool TryProperty(StringBuffer &sb, CArrRef info, const std::string &subsymbol); - static bool TryMethod(DebuggerClient *client, StringBuffer &sb, + static bool TryMethod(DebuggerClient &client, StringBuffer &sb, CArrRef info, std::string subsymbol); static void PrintDocComments(StringBuffer &sb, CArrRef info); - static void PrintInfo(DebuggerClient *client, StringBuffer &sb, CArrRef info, + static void PrintInfo(DebuggerClient &client, StringBuffer &sb, CArrRef info, const std::string &subsymbol); - static void PrintHeader(DebuggerClient *client, StringBuffer &sb, + static void PrintHeader(DebuggerClient &client, StringBuffer &sb, CArrRef info); }; diff --git a/hphp/runtime/eval/debugger/cmd/cmd_instrument.cpp b/hphp/runtime/eval/debugger/cmd/cmd_instrument.cpp index 8ade8088d..fd1120a03 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_instrument.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_instrument.cpp @@ -38,10 +38,10 @@ void CmdInstrument::recvImpl(DebuggerThriftBuffer &thrift) { InstPointInfo::RecvImpl(m_ips, thrift); } -void CmdInstrument::help(DebuggerClient *client) { - client->helpTitle("Instrument Command"); +void CmdInstrument::help(DebuggerClient &client) { + client.helpTitle("Instrument Command"); // TODO: more functionalities - client->helpCmds("inst here [desc]", + client.helpCmds("inst here [desc]", "inject to here", "inst () [desc]", "inject to the entry point of ", @@ -50,40 +50,40 @@ void CmdInstrument::help(DebuggerClient *client) { "inst [c]lear", "clear all injections", nullptr); - client->helpBody( + client.helpBody( "Use this command to instrument the program" ); } -void CmdInstrument::onClientImpl(DebuggerClient *client) { +void CmdInstrument::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 1) { - if (client->argValue(1) == "list" || client->argValue(1) == "l") { + if (client.argCount() == 1) { + if (client.argValue(1) == "list" || client.argValue(1) == "l") { listInst(client); return; } - if (client->argValue(1) == "clear" || client->argValue(1) == "c") { + if (client.argValue(1) == "clear" || client.argValue(1) == "c") { clearInst(client); return; } } - if (client->argCount() < 2 || client->argValue(1) == "help") { + if (client.argCount() < 2 || client.argValue(1) == "help") { help(client); return; } - std::string loc = client->argValue(1); - std::string file = client->argValue(2); + std::string loc = client.argValue(1); + std::string file = client.argValue(2); std::string desc; - if (client->argCount() >= 3) { - desc = client->argValue(3); + if (client.argCount() >= 3) { + desc = client.argValue(3); } Variant code = f_file_get_contents(file.c_str()); if (code.isNull()) { - client->error("Unable to read from file %s", file.c_str()); + client.error("Unable to read from file %s", file.c_str()); return; } - m_instPoints = client->getInstPoints(); + m_instPoints = client.getInstPoints(); if (loc == "here") { InstPointInfoPtr ipi(new InstPointInfo()); ipi->setLocHere(); @@ -97,15 +97,15 @@ void CmdInstrument::onClientImpl(DebuggerClient *client) { ipi->m_desc = desc; m_instPoints->push_back(ipi); } else { - client->error("Not implemented\n"); + client.error("Not implemented\n"); return; } m_type = ActionWrite; - CmdInstrumentPtr instCmdPtr = client->xend(this); + CmdInstrumentPtr instCmdPtr = client.xend(this); if (!instCmdPtr->m_enabled) { - client->error("Instrumentation is not enabled on the server"); + client.error("Instrumentation is not enabled on the server"); } - client->setInstPoints(instCmdPtr->m_ips); + client.setInstPoints(instCmdPtr->m_ips); CmdInstrument::PrintInstPoints(client); } @@ -118,11 +118,11 @@ static const StaticString s_line("line"); static const StaticString s_func_entry("func_entry"); static const StaticString s_func("func"); -void CmdInstrument::setClientOutput(DebuggerClient *client) { +void CmdInstrument::setClientOutput(DebuggerClient &client) { // Output all instrumentation point info - client->setOutputType(DebuggerClient::OTValues); + client.setOutputType(DebuggerClient::OTValues); Array values; - InstPointInfoPtrVec* ips = client->getInstPoints(); + InstPointInfoPtrVec* ips = client.getInstPoints(); for (unsigned int i = 0; i < ips->size(); i++) { InstPointInfoPtr ipi = (*ips)[i]; Array instpoint; @@ -138,10 +138,10 @@ void CmdInstrument::setClientOutput(DebuggerClient *client) { } values.append(instpoint); } - client->setOTValues(values); + client.setOTValues(values); } -bool CmdInstrument::onServer(DebuggerProxy *proxy) { +bool CmdInstrument::onServer(DebuggerProxy &proxy) { m_instPoints = &m_ips; m_enabled = true; if (m_type == ActionRead) { @@ -149,19 +149,19 @@ bool CmdInstrument::onServer(DebuggerProxy *proxy) { } else if (m_type == ActionWrite) { validateAndWriteToTable(proxy); } - return proxy->sendToClient(this); + return proxy.sendToClient(this); } -void CmdInstrument::readFromTable(DebuggerProxy *proxy) { - proxy->readInjTablesFromThread(); +void CmdInstrument::readFromTable(DebuggerProxy &proxy) { + proxy.readInjTablesFromThread(); m_ips.clear(); - if (!proxy->getInjTables()) { + if (!proxy.getInjTables()) { // nothing there return; } // Bytecode address InjectionTableInt64* tablePC = - proxy->getInjTables()->getInt64Table(InstHookTypeBCPC); + proxy.getInjTables()->getInt64Table(InstHookTypeBCPC); if (tablePC) { for (InjectionTableInt64::const_iterator it = tablePC->begin(); it != tablePC->end(); ++it) { @@ -178,7 +178,7 @@ void CmdInstrument::readFromTable(DebuggerProxy *proxy) { } } InjectionTableSD* tableFEntry = - proxy->getInjTables()->getSDTable(InstHookTypeFuncEntry); + proxy.getInjTables()->getSDTable(InstHookTypeFuncEntry); if (tableFEntry) { for (InjectionTableSD::const_iterator it = tableFEntry->begin(); it != tableFEntry->end(); ++it) { @@ -195,9 +195,9 @@ void CmdInstrument::readFromTable(DebuggerProxy *proxy) { } } -void CmdInstrument::validateAndWriteToTable(DebuggerProxy *proxy) { - if (!proxy->getInjTables()) { - proxy->setInjTables(new InjectionTables()); +void CmdInstrument::validateAndWriteToTable(DebuggerProxy &proxy) { + if (!proxy.getInjTables()) { + proxy.setInjTables(new InjectionTables()); } InjectionTableInt64* tablePC = nullptr; InjectionTableSD* tableFEntry = nullptr; @@ -233,41 +233,41 @@ void CmdInstrument::validateAndWriteToTable(DebuggerProxy *proxy) { } } - proxy->getInjTables()->setInt64Table(InstHookTypeBCPC, tablePC); - proxy->getInjTables()->setSDTable(InstHookTypeFuncEntry, tableFEntry); + proxy.getInjTables()->setInt64Table(InstHookTypeBCPC, tablePC); + proxy.getInjTables()->setSDTable(InstHookTypeFuncEntry, tableFEntry); - proxy->writeInjTablesToThread(); + proxy.writeInjTablesToThread(); } -void CmdInstrument::listInst(DebuggerClient *client) { +void CmdInstrument::listInst(DebuggerClient &client) { m_type = ActionRead; - m_instPoints = client->getInstPoints(); - CmdInstrumentPtr instCmdPtr = client->xend(this); - client->setInstPoints(instCmdPtr->m_ips); + m_instPoints = client.getInstPoints(); + CmdInstrumentPtr instCmdPtr = client.xend(this); + client.setInstPoints(instCmdPtr->m_ips); PrintInstPoints(client); } -void CmdInstrument::clearInst(DebuggerClient *client) { +void CmdInstrument::clearInst(DebuggerClient &client) { m_type = ActionWrite; - m_instPoints = client->getInstPoints(); + m_instPoints = client.getInstPoints(); m_instPoints->clear(); - CmdInstrumentPtr instCmdPtr = client->xend(this); - client->setInstPoints(instCmdPtr->m_ips); + CmdInstrumentPtr instCmdPtr = client.xend(this); + client.setInstPoints(instCmdPtr->m_ips); PrintInstPoints(client); } -void CmdInstrument::PrintInstPoints(DebuggerClient *client) { - InstPointInfoPtrVec* ips = client->getInstPoints(); +void CmdInstrument::PrintInstPoints(DebuggerClient &client) { + InstPointInfoPtrVec* ips = client.getInstPoints(); int size = ips->size(); - client->print("%d instrumentation points", size); + client.print("%d instrumentation points", size); for (int i = 0; i < size; i++) { InstPointInfoPtr ipi = (*ips)[i]; if (ipi->m_locType == InstPointInfo::LocFileLine) { - client->print(" %d\t%s\t%s\tfile:\t%s:%d", i, + client.print(" %d\t%s\t%s\tfile:\t%s:%d", i, ipi->m_valid ? "valid" : "invalid", ipi->m_desc.c_str(), ipi->m_file.c_str(), ipi->m_line); } else if (ipi->m_locType == InstPointInfo::LocFuncEntry) { - client->print(" %d\t%s\t%s\tfunc entry:\t%s", i, + client.print(" %d\t%s\t%s\tfunc entry:\t%s", i, ipi->m_valid ? "valid" : "invalid", ipi->m_desc.c_str(), ipi->m_func.c_str()); } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_instrument.h b/hphp/runtime/eval/debugger/cmd/cmd_instrument.h index 7e2f1f20b..8d19011af 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_instrument.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_instrument.h @@ -29,12 +29,12 @@ public: CmdInstrument() : DebuggerCommand(KindOfInstrument), m_type(ActionRead), m_enabled(false), m_instPoints(nullptr) {} - virtual void help(DebuggerClient *client); - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void help(DebuggerClient &client); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); @@ -49,13 +49,13 @@ private: InstPointInfoPtrVec *m_instPoints; InstPointInfoPtrVec m_ips; - void readFromTable(DebuggerProxy *proxy); - void validateAndWriteToTable(DebuggerProxy *proxy); + void readFromTable(DebuggerProxy &proxy); + void validateAndWriteToTable(DebuggerProxy &proxy); - void listInst(DebuggerClient *client); - void clearInst(DebuggerClient *client); + void listInst(DebuggerClient &client); + void clearInst(DebuggerClient &client); - static void PrintInstPoints(DebuggerClient *client); + static void PrintInstPoints(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_interrupt.cpp b/hphp/runtime/eval/debugger/cmd/cmd_interrupt.cpp index bdd5dc1b4..148155332 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_interrupt.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_interrupt.cpp @@ -129,43 +129,43 @@ std::string CmdInterrupt::desc() const { return ""; } -void CmdInterrupt::onClientImpl(DebuggerClient *client) { - client->setCurrentLocation(m_threadId, m_bpi); - if (!client->getDebuggerSmallStep()) { +void CmdInterrupt::onClientImpl(DebuggerClient &client) { + client.setCurrentLocation(m_threadId, m_bpi); + if (!client.getDebuggerSmallStep()) { // Adjust line and char if it's not small stepping if (m_bpi->m_line1 == m_bpi->m_line2) { m_bpi->m_char1 = 1; m_bpi->m_char2 = 100; } } - client->setMatchedBreakPoints(m_matched); + client.setMatchedBreakPoints(m_matched); switch (m_interrupt) { case SessionStarted: if (!m_program.empty()) { - client->info("Program %s loaded. Type '[r]un' or '[c]ontinue' to go.", + client.info("Program %s loaded. Type '[r]un' or '[c]ontinue' to go.", m_program.c_str()); m_bpi->m_file = m_program; } break; case SessionEnded: if (!m_program.empty()) { - client->info("Program %s exited normally.", m_program.c_str()); + client.info("Program %s exited normally.", m_program.c_str()); } break; case RequestStarted: if (!m_program.empty()) { - client->info("Web request %s started.", m_program.c_str()); + client.info("Web request %s started.", m_program.c_str()); } break; case RequestEnded: if (!m_program.empty()) { - client->info("Web request %s ended.", m_program.c_str()); + client.info("Web request %s ended.", m_program.c_str()); } break; case PSPEnded: if (!m_program.empty()) { - client->info("Post-Send Processing for %s was ended.", + client.info("Post-Send Processing for %s was ended.", m_program.c_str()); } break; @@ -174,7 +174,7 @@ void CmdInterrupt::onClientImpl(DebuggerClient *client) { case ExceptionThrown: { bool found = false; bool toggled = false; - BreakPointInfoPtrVec *bps = client->getBreakPoints(); + BreakPointInfoPtrVec *bps = client.getBreakPoints(); for (unsigned int i = 0; i < m_matched.size(); i++) { BreakPointInfoPtr bpm = m_matched[i]; BreakPointInfoPtr bp; @@ -193,27 +193,27 @@ void CmdInterrupt::onClientImpl(DebuggerClient *client) { } if (m_interrupt == BreakPointReached || m_interrupt == HardBreakPoint) { - client->info("Breakpoint %d reached %s", bp->index(), + client.info("Breakpoint %d reached %s", bp->index(), m_bpi->site().c_str()); - client->shortCode(m_bpi); + client.shortCode(m_bpi); } else { if (m_bpi->m_exceptionClass == BreakPointInfo::ErrorClassName) { - client->info("Breakpoint %d reached: An error occurred %s", + client.info("Breakpoint %d reached: An error occurred %s", bp->index(), m_bpi->site().c_str()); - client->shortCode(m_bpi); - client->error("Error Message: %s", + client.shortCode(m_bpi); + client.error("Error Message: %s", m_bpi->m_exceptionObject.c_str()); } else { - client->info("Breakpoint %d reached: Throwing %s %s", + client.info("Breakpoint %d reached: Throwing %s %s", bp->index(), m_bpi->m_exceptionClass.c_str(), m_bpi->site().c_str()); - client->shortCode(m_bpi); - client->output(m_bpi->m_exceptionObject); + client.shortCode(m_bpi); + client.output(m_bpi->m_exceptionObject); } } if (!bpm->m_output.empty()) { - client->print(bpm->m_output); + client.print(bpm->m_output); } } } @@ -223,17 +223,17 @@ void CmdInterrupt::onClientImpl(DebuggerClient *client) { if (!found) { if (m_interrupt == HardBreakPoint) { // for HardBreakPoint, default the frame to the caller - client->setFrame(1); + client.setFrame(1); } - client->info("Break %s", m_bpi->site().c_str()); - client->shortCode(m_bpi); + client.info("Break %s", m_bpi->site().c_str()); + client.shortCode(m_bpi); } break; } } if (!m_errorMsg.empty()) { - client->error(m_errorMsg); + client.error(m_errorMsg); } // watches @@ -242,13 +242,13 @@ void CmdInterrupt::onClientImpl(DebuggerClient *client) { case RequestStarted: break; default: { - DebuggerClient::WatchPtrVec &watches = client->getWatches(); + DebuggerClient::WatchPtrVec &watches = client.getWatches(); for (int i = 0; i < (int)watches.size(); i++) { - if (i > 0) client->output(""); - client->info("Watch %d: %s =", i + 1, watches[i]->second.c_str()); + if (i > 0) client.output(""); + client.info("Watch %d: %s =", i + 1, watches[i]->second.c_str()); Variant v = CmdPrint().processWatch(client, watches[i]->first, watches[i]->second); - client->output(CmdPrint::FormatResult(watches[i]->first, v)); + client.output(CmdPrint::FormatResult(watches[i]->first, v)); } } } @@ -258,11 +258,11 @@ static const StaticString s_format("format"); static const StaticString s_php("php"); static const StaticString s_value("value"); -void CmdInterrupt::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTCodeLoc); - client->setOTFileLine(m_bpi->m_file, m_bpi->m_line1); +void CmdInterrupt::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTCodeLoc); + client.setOTFileLine(m_bpi->m_file, m_bpi->m_line1); Array values; - DebuggerClient::WatchPtrVec &watches = client->getWatches(); + DebuggerClient::WatchPtrVec &watches = client.getWatches(); for (int i = 0; i < (int)watches.size(); i++) { ArrayInit watch(3); watch.set(s_format, watches[i]->first); @@ -272,11 +272,11 @@ void CmdInterrupt::setClientOutput(DebuggerClient *client) { watch.set(s_value, CmdPrint::FormatResult(watches[i]->first, v)); values.append(watch.create()); } - client->setOTValues(values); + client.setOTValues(values); } -bool CmdInterrupt::onServer(DebuggerProxy *proxy) { - return proxy->sendToClient(this); +bool CmdInterrupt::onServer(DebuggerProxy &proxy) { + return proxy.sendToClient(this); } bool CmdInterrupt::shouldBreak(const BreakPointInfoPtrVec &bps) { diff --git a/hphp/runtime/eval/debugger/cmd/cmd_interrupt.h b/hphp/runtime/eval/debugger/cmd/cmd_interrupt.h index 2222691cf..91191cfa8 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_interrupt.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_interrupt.h @@ -44,8 +44,8 @@ public: std::string desc() const; std::string error() const { return m_errorMsg;} - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); bool shouldBreak(const BreakPointInfoPtrVec &bps); std::string getFileLine() const; @@ -53,7 +53,7 @@ public: InterruptSite *getSite() { return m_site;} protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_list.cpp b/hphp/runtime/eval/debugger/cmd/cmd_list.cpp index 01be96e2a..d83b9b144 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_list.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_list.cpp @@ -45,14 +45,14 @@ void CmdList::recvImpl(DebuggerThriftBuffer &thrift) { // Informs the client of all strings that may follow a list command. // Used for auto completion. The client uses the prefix of the argument // following the command to narrow down the list displayed to the user. -void CmdList::list(DebuggerClient *client) { - client->addCompletion(DebuggerClient::AutoCompleteFileNames); +void CmdList::list(DebuggerClient &client) { + client.addCompletion(DebuggerClient::AutoCompleteFileNames); } // The text to display when the debugger client processes "help break". -void CmdList::help(DebuggerClient *client) { - client->helpTitle("List Command"); - client->helpCmds( +void CmdList::help(DebuggerClient &client) { + client.helpTitle("List Command"); + client.helpCmds( "list", "displays current block of source code", "list {line}", "displays code around specified line", "list {line1}-{line2}", "displays specified block of source code", @@ -69,7 +69,7 @@ void CmdList::help(DebuggerClient *client) { "list {directory}", "sets PHP source root directory", nullptr ); - client->helpBody( + client.helpBody( "Use list command to display PHP source code. In remote debugging, this " "is displaying source code on server side. When server side cannot find " "the file, it will fall back to local files.\n" @@ -83,29 +83,29 @@ void CmdList::help(DebuggerClient *client) { ); } -bool CmdList::listCurrent(DebuggerClient *client, int &line, +bool CmdList::listCurrent(DebuggerClient &client, int &line, int &charFocus0, int &lineFocus1, int &charFocus1) { int linePrev = 0; - client->getListLocation(m_file, linePrev, line, charFocus0, lineFocus1, + client.getListLocation(m_file, linePrev, line, charFocus0, lineFocus1, charFocus1); if (m_line1 == 0 && m_line2 == 0) { m_line1 = linePrev + 1; m_line2 = m_line1 + DebuggerClient::CodeBlockSize; } if (m_file.empty()) { - string code = client->getCode(); + string code = client.getCode(); if (code.empty()) { - client->error("There is no current source file."); + client.error("There is no current source file."); return true; } - client->print(highlight_php(code)); + client.print(highlight_php(code)); return true; } return false; } -bool CmdList::listFileRange(DebuggerClient *client, int line, +bool CmdList::listFileRange(DebuggerClient &client, int line, int charFocus0, int lineFocus1, int charFocus1) { if (m_line1 <= 0) m_line1 = 1; @@ -116,13 +116,13 @@ bool CmdList::listFileRange(DebuggerClient *client, int line, m_line2 = tmp; } - CmdListPtr res = client->xend(this); + CmdListPtr res = client.xend(this); if (res->m_code.isString()) { - if (!client->code(res->m_code, line, m_line1, m_line2, charFocus0, + if (!client.code(res->m_code, line, m_line1, m_line2, charFocus0, lineFocus1, charFocus1)) { - client->info("No more lines in %s to display.", m_file.c_str()); + client.info("No more lines in %s to display.", m_file.c_str()); } - client->setListLocation(m_file, m_line2, false); + client.setListLocation(m_file, m_line2, false); return true; } return false; @@ -134,13 +134,13 @@ static const StaticString s_line1("line2"), s_line2("line2"); -bool CmdList::listFunctionOrClass(DebuggerClient *client) { - assert(client->argCount() == 1); +bool CmdList::listFunctionOrClass(DebuggerClient &client) { + assert(client.argCount() == 1); CmdInfoPtr cmdInfo(new CmdInfo()); DebuggerCommandPtr deleter(cmdInfo); string subsymbol; cmdInfo->parseOneArg(client, subsymbol); - CmdInfoPtr cmd = client->xend(cmdInfo.get()); + CmdInfoPtr cmd = client.xend(cmdInfo.get()); Array info = cmd->getInfo(); if (info.empty()) return false; always_assert(info.size() == 1); @@ -156,7 +156,7 @@ bool CmdList::listFunctionOrClass(DebuggerClient *client) { int line2 = funcInfo[s_line2].toInt32(); int line = line1 ? line1 : line2; if (file.empty() || !line) return false; - client->setListLocation(file.data(), line - 1, false); + client.setListLocation(file.data(), line - 1, false); line = 0; int charFocus0 = 0; int lineFocus1 = 0; @@ -172,21 +172,21 @@ bool CmdList::listFunctionOrClass(DebuggerClient *client) { return false; } -void CmdList::onClientImpl(DebuggerClient *client) { +void CmdList::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() > 1) { + if (client.argCount() > 1) { help(client); return; } int line = 0; m_line1 = m_line2 = 0; - if (client->argCount() == 1) { - string arg = client->argValue(1); + if (client.argCount() == 1) { + string arg = client.argValue(1); if (DebuggerClient::IsValidNumber(arg)) { line = atoi(arg.c_str()); if (line <= 0) { - client->error("A line number has to be a positive integer."); + client.error("A line number has to be a positive integer."); help(client); return; } @@ -194,7 +194,7 @@ void CmdList::onClientImpl(DebuggerClient *client) { m_line2 = m_line1 + DebuggerClient::CodeBlockSize; } else if (arg.find("::") != string::npos) { if (!listFunctionOrClass(client)) { - client->error("Unable to read specified method."); + client.error("Unable to read specified method."); } return; } else { @@ -203,7 +203,7 @@ void CmdList::onClientImpl(DebuggerClient *client) { if (pos != string::npos) { m_file = arg.substr(0, pos); if (m_file.empty()) { - client->error("File name cannot be empty."); + client.error("File name cannot be empty."); help(client); return; } @@ -220,7 +220,7 @@ void CmdList::onClientImpl(DebuggerClient *client) { m_line1 = 1; m_line2 = DebuggerClient::CodeBlockSize; } else { - client->error("Line numbers have to be integers."); + client.error("Line numbers have to be integers."); help(client); return; } @@ -234,7 +234,7 @@ void CmdList::onClientImpl(DebuggerClient *client) { m_line2 = m_line1 + DebuggerClient::CodeBlockSize; } if (m_line1 <= 0 || m_line2 <= 0) { - client->error("Line numbers have to be positive integers."); + client.error("Line numbers have to be positive integers."); help(client); return; } @@ -246,14 +246,14 @@ void CmdList::onClientImpl(DebuggerClient *client) { m_line1 = 1; m_line2 = DebuggerClient::CodeBlockSize; } else { - client->error("A line number has to be an integer."); + client.error("A line number has to be an integer."); help(client); return; } } else { int line = atoi(arg.c_str()); if (line <= 0) { - client->error("A line number has to be a positive integer."); + client.error("A line number has to be a positive integer."); help(client); return; } @@ -276,25 +276,25 @@ void CmdList::onClientImpl(DebuggerClient *client) { struct stat sb; stat(m_file.c_str(), &sb); 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()); + client.setSourceRoot(m_file); + client.info("PHP source root directory is set to %s", m_file.c_str()); return; } } if (listFileRange(client, line, charFocus0, lineFocus1, charFocus1)) { return; - } else if (client->argCount() != 1 || !listFunctionOrClass(client)) { - client->error( + } else if (client.argCount() != 1 || !listFunctionOrClass(client)) { + client.error( "Unable to read specified function, class or source file location."); return; } } -bool CmdList::onServer(DebuggerProxy *proxy) { +bool CmdList::onServer(DebuggerProxy &proxy) { m_code = f_file_get_contents(m_file.c_str()); if (!m_code && m_file[0] != '/') { - DSandboxInfo info = proxy->getSandbox(); + DSandboxInfo info = proxy.getSandbox(); if (info.m_path.empty()) { raise_warning("path for sandbox %s is not setup, run a web request", info.desc().c_str()); @@ -303,17 +303,17 @@ bool CmdList::onServer(DebuggerProxy *proxy) { m_code = f_file_get_contents(full_path.c_str()); } } - return proxy->sendToClient(this); + return proxy.sendToClient((DebuggerCommand*)this); } // Sends a "list file" command to the proxy attached to the given client. // Returns false if the file does not exist or could not be read or an // HPHP::String instance containing the contents of the file. -Variant CmdList::GetSourceFile(DebuggerClient *client, +Variant CmdList::GetSourceFile(DebuggerClient &client, const std::string &file) { CmdList cmd; cmd.m_file = file; - CmdListPtr res = client->xend(&cmd); + CmdListPtr res = client.xend(&cmd); return res->m_code; } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_list.h b/hphp/runtime/eval/debugger/cmd/cmd_list.h index 69b91ff1c..8c873eafb 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_list.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_list.h @@ -30,28 +30,28 @@ public: // Sends a "list file" command to the proxy attached to the given client. // Returns false if the file does not exist or could not be read or an // HPHP::String instance containing the contents of the file. - static Variant GetSourceFile(DebuggerClient *client, + static Variant GetSourceFile(DebuggerClient &client, const std::string &file); // Informs the client of all strings that may follow a list command. // Used for auto completion. The client uses the prefix of the argument // following the command to narrow down the list displayed to the user. - virtual void list(DebuggerClient *client); + virtual void list(DebuggerClient &client); // The text to display when the debugger client processes "help break". - virtual void 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 // to the client. - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: // Verifies the arguments of this command, sends the command to the // 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 void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); // Serializes this command into the given Thrift buffer. virtual void sendImpl(DebuggerThriftBuffer &thrift); @@ -75,15 +75,15 @@ private: // range of source text to be listed by this command. Variant m_code; - bool listCurrent(DebuggerClient *client, int &line, + bool listCurrent(DebuggerClient &client, int &line, int &charFocus0, int &lineFocus1, int &charFocus1); - bool listFileRange(DebuggerClient *client, int line, + bool listFileRange(DebuggerClient &client, int line, int charFocus0, int lineFocus1, int charFocus1); - bool listFunctionOrClass(DebuggerClient *client); + bool listFunctionOrClass(DebuggerClient &client); }; diff --git a/hphp/runtime/eval/debugger/cmd/cmd_machine.cpp b/hphp/runtime/eval/debugger/cmd/cmd_machine.cpp index 75cb0ef1e..8390b834c 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_machine.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_machine.cpp @@ -43,17 +43,17 @@ void CmdMachine::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_succeed); } -void CmdMachine::list(DebuggerClient *client) { - if (client->argCount() == 0) { +void CmdMachine::list(DebuggerClient &client) { + if (client.argCount() == 0) { static const char *keywords[] = { "disconnect", "connect", "rpc", "list", "attach", nullptr }; - client->addCompletion(keywords); + client.addCompletion(keywords); } } -void CmdMachine::help(DebuggerClient *client) { - client->helpTitle("Machine Command"); - client->helpCmds( +void CmdMachine::help(DebuggerClient &client) { + client.helpTitle("Machine Command"); + client.helpCmds( "[m]achine [c]onnect {host}", "debugging remote server natively", "[m]achine [c]onnect {host}:{port}", "debugging remote server natively", "[m]achine [r]pc {host}", "debugging remote server with RPC", @@ -66,7 +66,7 @@ void CmdMachine::help(DebuggerClient *client) { "attach to a sandbox by user and name", nullptr ); - client->helpBody( + client.helpBody( "Use this command to switch between different machines or " "sandboxes.\n" "\n" @@ -99,25 +99,25 @@ void CmdMachine::help(DebuggerClient *client) { ); } -bool CmdMachine::processList(DebuggerClient *client, +bool CmdMachine::processList(DebuggerClient &client, bool output /* = true */) { m_body = "list"; - CmdMachinePtr res = client->xend(this); - client->updateSandboxes(res->m_sandboxes); + CmdMachinePtr res = client.xend(this); + client.updateSandboxes(res->m_sandboxes); if (!output) return true; if (res->m_sandboxes.empty()) { - client->info("(no sandbox was found)"); - client->tutorial( + client.info("(no sandbox was found)"); + client.tutorial( "Please hit the sandbox from browser at least once. Then run " "'[m]achine [l]ist' again." ); } else { for (int i = 0; i < (int)res->m_sandboxes.size(); i++) { - client->print(" %d\t%s", i + 1, + client.print(" %d\t%s", i + 1, res->m_sandboxes[i]->desc().c_str()); } - client->tutorial( + client.tutorial( "Use '[m]achine [a]ttach {index}' to attach to one sandbox. For " "example, 'm a 1'. If desired sandbox is not on the list, please " "hit the sandbox from browser once. Then run '[m]achine [l]ist' " @@ -128,16 +128,16 @@ bool CmdMachine::processList(DebuggerClient *client, return true; } -bool CmdMachine::AttachSandbox(DebuggerClient *client, +bool CmdMachine::AttachSandbox(DebuggerClient &client, const char *user /* = NULL */, const char *name /* = NULL */, bool force /* = false */) { string login; if (user == nullptr) { - login = client->getCurrentUser(); + login = client.getCurrentUser(); user = login.c_str(); } - if (client->isApiMode()) { + if (client.isApiMode()) { force = true; } @@ -147,11 +147,11 @@ bool CmdMachine::AttachSandbox(DebuggerClient *client, return AttachSandbox(client, sandbox, force); } -bool CmdMachine::AttachSandbox(DebuggerClient *client, +bool CmdMachine::AttachSandbox(DebuggerClient &client, DSandboxInfoPtr sandbox, bool force /* = false */) { - if (client->isLocal()) { - client->error("Local script doesn't have sandbox to attach to."); + if (client.isLocal()) { + client.error("Local script doesn't have sandbox to attach to."); return false; } @@ -160,13 +160,13 @@ bool CmdMachine::AttachSandbox(DebuggerClient *client, cmd.m_sandboxes.push_back(sandbox); cmd.m_force = force; - client->info("Attaching to %s and pre-loading, please wait...", + client.info("Attaching to %s and pre-loading, please wait...", sandbox->desc().c_str()); - CmdMachinePtr cmdMachine = client->xend(&cmd); + CmdMachinePtr cmdMachine = client.xend(&cmd); if (cmdMachine->m_succeed) { - client->playMacro("startup"); + client.playMacro("startup"); } else { - client->error("failed to attach to sandbox, maybe another client is " + client.error("failed to attach to sandbox, maybe another client is " "debugging, \nattach to another sandbox, exit the " "attached hphpd client, or try \n" "[m]achine [a]ttach [f]orce [%s] [%s]", @@ -180,7 +180,7 @@ static const StaticString s_port("port"); static const StaticString s_auth("auth"); static const StaticString s_timeout("timeout"); -void CmdMachine::UpdateIntercept(DebuggerClient *client, +void CmdMachine::UpdateIntercept(DebuggerClient &client, const std::string &host, int port) { CmdMachine cmd; cmd.m_body = "rpc"; @@ -189,28 +189,28 @@ void CmdMachine::UpdateIntercept(DebuggerClient *client, s_port, port ? port : RuntimeOption::DebuggerDefaultRpcPort, s_auth, String(RuntimeOption::DebuggerDefaultRpcAuth), s_timeout, RuntimeOption::DebuggerDefaultRpcTimeout); - client->xend(&cmd); + client.xend(&cmd); } -void CmdMachine::onClientImpl(DebuggerClient *client) { +void CmdMachine::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { + if (client.argCount() == 0) { help(client); return; } - bool rpc = client->arg(1, "rpc"); - if (rpc || client->arg(1, "connect")) { - if (client->argCount() != 2) { + bool rpc = client.arg(1, "rpc"); + if (rpc || client.arg(1, "connect")) { + if (client.argCount() != 2) { help(client); return; } - string host = client->argValue(2); + string host = client.argValue(2); int port = 0; size_t pos = host.find(":"); if (pos != string::npos) { if (!DebuggerClient::IsValidNumber(host.substr(pos + 1))) { - client->error("Port needs to be a number"); + client.error("Port needs to be a number"); help(client); return; } @@ -219,43 +219,43 @@ void CmdMachine::onClientImpl(DebuggerClient *client) { } if (rpc) { - if (client->connectRPC(host, port)) { + if (client.connectRPC(host, port)) { throw DebuggerConsoleExitException(); } } else { - if (client->connect(host, port)) { + if (client.connect(host, port)) { throw DebuggerConsoleExitException(); } } - client->initializeMachine(); + client.initializeMachine(); return; } - if (client->arg(1, "disconnect")) { - if (client->disconnect()) { + if (client.arg(1, "disconnect")) { + if (client.disconnect()) { throw DebuggerConsoleExitException(); } - client->initializeMachine(); + client.initializeMachine(); return; } - if (client->arg(1, "list")) { + if (client.arg(1, "list")) { processList(client); return; } - if (client->arg(1, "attach")) { + if (client.arg(1, "attach")) { DSandboxInfoPtr sandbox; - string snum = client->argValue(2); + string snum = client.argValue(2); if (DebuggerClient::IsValidNumber(snum)) { int num = atoi(snum.c_str()); - sandbox = client->getSandbox(num); + sandbox = client.getSandbox(num); if (!sandbox) { processList(client, false); - sandbox = client->getSandbox(num); + sandbox = client.getSandbox(num); if (!sandbox) { - client->error("\"%s\" is not a valid sandbox index. Choose one from " + client.error("\"%s\" is not a valid sandbox index. Choose one from " "this list:", snum.c_str()); processList(client); return; @@ -263,20 +263,20 @@ void CmdMachine::onClientImpl(DebuggerClient *client) { } } else { int argBase = 2; - if (client->argCount() >= 2 && client->arg(2, "force")) { + if (client.argCount() >= 2 && client.arg(2, "force")) { m_force = true; argBase++; } sandbox = DSandboxInfoPtr(new DSandboxInfo()); - if (client->argCount() < argBase) { - sandbox->m_user = client->getCurrentUser(); + if (client.argCount() < argBase) { + sandbox->m_user = client.getCurrentUser(); sandbox->m_name = "default"; - } else if (client->argCount() == argBase) { - sandbox->m_user = client->getCurrentUser(); - sandbox->m_name = client->argValue(argBase); - } else if (client->argCount() == argBase + 1) { - sandbox->m_user = client->argValue(argBase); - sandbox->m_name = client->argValue(argBase + 1); + } else if (client.argCount() == argBase) { + sandbox->m_user = client.getCurrentUser(); + sandbox->m_name = client.argValue(argBase); + } else if (client.argCount() == argBase + 1) { + sandbox->m_user = client.argValue(argBase); + sandbox->m_name = client.argValue(argBase + 1); } else { help(client); return; @@ -292,7 +292,7 @@ void CmdMachine::onClientImpl(DebuggerClient *client) { help(client); } -bool CmdMachine::onServer(DebuggerProxy *proxy) { +bool CmdMachine::onServer(DebuggerProxy &proxy) { if (m_body == "rpc") { String host = m_rpcConfig[s_host].toString(); if (host.empty()) { @@ -302,19 +302,19 @@ bool CmdMachine::onServer(DebuggerProxy *proxy) { LibEventHttpClient::SetCache(host.data(), port, 1); register_intercept("", "fb_rpc_intercept_handler", m_rpcConfig); } - return proxy->sendToClient(this); + return proxy.sendToClient(this); } if (m_body == "list") { Debugger::GetRegisteredSandboxes(m_sandboxes); - return proxy->sendToClient(this); + return proxy.sendToClient(this); } if (m_body == "attach" && !m_sandboxes.empty()) { - m_succeed = proxy->switchSandbox(m_sandboxes[0]->id(), m_force); + m_succeed = proxy.switchSandbox(m_sandboxes[0]->id(), m_force); if (m_succeed) { - proxy->notifyDummySandbox(); + proxy.notifyDummySandbox(); m_exitInterrupt = true; } - return proxy->sendToClient(this); + return proxy.sendToClient(this); } return false; } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_machine.h b/hphp/runtime/eval/debugger/cmd/cmd_machine.h index 40d98890f..260ec3b06 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_machine.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_machine.h @@ -25,25 +25,25 @@ namespace HPHP { namespace Eval { DECLARE_BOOST_TYPES(CmdMachine); class CmdMachine : public DebuggerCommand { public: - static bool AttachSandbox(DebuggerClient *client, const char *user = nullptr, + static bool AttachSandbox(DebuggerClient &client, const char *user = nullptr, const char *name = nullptr, bool force = false); - static bool AttachSandbox(DebuggerClient *client, + static bool AttachSandbox(DebuggerClient &client, DSandboxInfoPtr sandbox, bool force = false); - static void UpdateIntercept(DebuggerClient *client, + static void UpdateIntercept(DebuggerClient &client, const std::string &host, int port); public: CmdMachine() : DebuggerCommand(KindOfMachine), m_force(false), m_succeed(false) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); @@ -53,7 +53,7 @@ private: bool m_force; bool m_succeed; - bool processList(DebuggerClient *client, bool output = true); + bool processList(DebuggerClient &client, bool output = true); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_macro.cpp b/hphp/runtime/eval/debugger/cmd/cmd_macro.cpp index 6ffe43203..1f60fc5a6 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_macro.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_macro.cpp @@ -21,17 +21,17 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdMacro::list(DebuggerClient *client) { - if (client->argCount() == 0) { +void CmdMacro::list(DebuggerClient &client) { + if (client.argCount() == 0) { static const char *keywords[] = { "start", "end", "replay", "list", "clear", nullptr}; - client->addCompletion(keywords); + client.addCompletion(keywords); } } -void CmdMacro::help(DebuggerClient *client) { - client->helpTitle("Macro Command"); - client->helpCmds( +void CmdMacro::help(DebuggerClient &client) { + client.helpTitle("Macro Command"); + client.helpCmds( "& [s]tart", "starts recording of default macro", "& [s]tart {name}", "starts recording of a named macro", "& [e]nd", "stops and saves recorded macro", @@ -41,7 +41,7 @@ void CmdMacro::help(DebuggerClient *client) { "& [c]lear {index}", "deletes a macro", nullptr ); - client->helpBody( + client.helpBody( "Macro command allows you to record a series of debugger command, so " "you can replay later by its name. When name is not specified, it will " "use \"default\" as the name.\n" @@ -54,38 +54,38 @@ void CmdMacro::help(DebuggerClient *client) { ); } -void CmdMacro::processList(DebuggerClient *client) { - const MacroPtrVec ¯os = client->getMacros(); +void CmdMacro::processList(DebuggerClient &client) { + const MacroPtrVec ¯os = client.getMacros(); for (unsigned int i = 0; i < macros.size(); i++) { MacroPtr macro = macros[i]; - client->output("%4d %s", i + 1, macro->m_name.c_str()); - client->print(macro->desc(" > ").c_str()); + client.output("%4d %s", i + 1, macro->m_name.c_str()); + client.print(macro->desc(" > ").c_str()); } } -void CmdMacro::onClientImpl(DebuggerClient *client) { +void CmdMacro::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { + if (client.argCount() == 0) { help(client); return; } - if (client->arg(1, "start")) { - client->startMacro(client->argValue(2)); - } else if (client->arg(1, "end")) { - client->endMacro(); - } else if (client->arg(1, "replay")) { - if (!client->playMacro(client->argValue(2))) { - client->error("Unable to find specified macro."); + if (client.arg(1, "start")) { + client.startMacro(client.argValue(2)); + } else if (client.arg(1, "end")) { + client.endMacro(); + } else if (client.arg(1, "replay")) { + if (!client.playMacro(client.argValue(2))) { + client.error("Unable to find specified macro."); processList(client); } - } else if (client->arg(1, "list")) { + } else if (client.arg(1, "list")) { processList(client); - } else if (client->arg(1, "clear")) { - string snum = client->argValue(2); + } else if (client.arg(1, "clear")) { + string snum = client.argValue(2); if (!DebuggerClient::IsValidNumber(snum)) { - client->error("'& [c]lear' needs an {index} argument."); - client->tutorial( + client.error("'& [c]lear' needs an {index} argument."); + client.tutorial( "You will have to run '& [l]ist' first to see a list of valid " "numbers or indices to specify." ); @@ -93,8 +93,8 @@ void CmdMacro::onClientImpl(DebuggerClient *client) { } int num = atoi(snum.c_str()); - if (!client->deleteMacro(num)) { - client->error("\"%s\" is not a valid macro index. Choose one from " + if (!client.deleteMacro(num)) { + client.error("\"%s\" is not a valid macro index. Choose one from " "this list:", snum.c_str()); processList(client); return; diff --git a/hphp/runtime/eval/debugger/cmd/cmd_macro.h b/hphp/runtime/eval/debugger/cmd/cmd_macro.h index 5e939676e..c4e27968c 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_macro.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_macro.h @@ -27,14 +27,14 @@ class CmdMacro : public DebuggerCommand { public: CmdMacro() : DebuggerCommand(KindOfMacro) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); private: - void processList(DebuggerClient *client); + void processList(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_next.cpp b/hphp/runtime/eval/debugger/cmd/cmd_next.cpp index 599d752f7..b80f4c038 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_next.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_next.cpp @@ -21,23 +21,23 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdNext::help(DebuggerClient *client) { - client->helpTitle("Next Command"); - client->helpCmds( +void CmdNext::help(DebuggerClient &client) { + client.helpTitle("Next Command"); + client.helpCmds( "[n]ext {count=1}", "steps over lines of code", nullptr ); - client->helpBody( + client.helpBody( "Use this command at break to step over lines of code. Specify a " "count to step over more than one line of code." ); } -void CmdNext::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdNext::onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt) { TRACE(2, "CmdNext::onSetup\n"); assert(!m_complete); // Complete cmds should not be asked to do work. CmdFlowControl::onSetup(proxy, interrupt); - m_stackDepth = proxy->getStackDepth(); + m_stackDepth = proxy.getStackDepth(); m_vmDepth = g_vmContext->m_nesting; m_loc = interrupt.getFileLine(); @@ -46,7 +46,7 @@ void CmdNext::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) { m_needsVMInterrupt = true; } -void CmdNext::onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdNext::onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt) { TRACE(2, "CmdNext::onBeginInterrupt\n"); assert(!m_complete); // Complete cmds should not be asked to do work. if (interrupt.getInterruptType() == ExceptionThrown) { @@ -58,7 +58,7 @@ void CmdNext::onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt) { } int currentVMDepth = g_vmContext->m_nesting; - int currentStackDepth = proxy->getStackDepth(); + int currentStackDepth = proxy.getStackDepth(); if ((currentVMDepth < m_vmDepth) || ((currentVMDepth == m_vmDepth) && (currentStackDepth <= m_stackDepth))) { diff --git a/hphp/runtime/eval/debugger/cmd/cmd_next.h b/hphp/runtime/eval/debugger/cmd/cmd_next.h index ffeb4178f..09eb85fff 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_next.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_next.h @@ -27,9 +27,9 @@ class CmdNext : public CmdFlowControl { public: CmdNext() : CmdFlowControl(KindOfNext) {} - virtual void help(DebuggerClient *client); - virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt); - virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt); + virtual void help(DebuggerClient &client); + virtual void onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt); + virtual void onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_out.cpp b/hphp/runtime/eval/debugger/cmd/cmd_out.cpp index 23bf23b20..897ba25b7 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_out.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_out.cpp @@ -21,30 +21,30 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdOut::help(DebuggerClient *client) { - client->helpTitle("Out Command"); - client->helpCmds( +void CmdOut::help(DebuggerClient &client) { + client.helpTitle("Out Command"); + client.helpCmds( "[o]ut {count=1}", "steps out function calls", nullptr ); - client->helpBody( + client.helpBody( "Use this command at break to step out function calls. Specify a " "count to step out more than one level of function calls." ); } -void CmdOut::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdOut::onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt) { TRACE(2, "CmdOut::onSetup\n"); assert(!m_complete); // Complete cmds should not be asked to do work. CmdFlowControl::onSetup(proxy, interrupt); - m_stackDepth = proxy->getStackDepth(); + m_stackDepth = proxy.getStackDepth(); m_vmDepth = g_vmContext->m_nesting; // Simply setup a "step out breakpoint" and let the program run. setupStepOut(); } -void CmdOut::onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdOut::onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt) { TRACE(2, "CmdNext::onBeginInterrupt\n"); assert(!m_complete); // Complete cmds should not be asked to do work. if (interrupt.getInterruptType() == ExceptionThrown) { @@ -56,7 +56,7 @@ void CmdOut::onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt) { } int currentVMDepth = g_vmContext->m_nesting; - int currentStackDepth = proxy->getStackDepth(); + int currentStackDepth = proxy.getStackDepth(); if (currentVMDepth < m_vmDepth) { // Cut corner here, just break when cross VM boundary no matter how // many levels we want to go out of diff --git a/hphp/runtime/eval/debugger/cmd/cmd_out.h b/hphp/runtime/eval/debugger/cmd/cmd_out.h index b12271454..449da981e 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_out.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_out.h @@ -27,9 +27,9 @@ class CmdOut : public CmdFlowControl { public: CmdOut() : CmdFlowControl(KindOfOut) {} - virtual void help(DebuggerClient *client); - virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt); - virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt); + virtual void help(DebuggerClient &client); + virtual void onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt); + virtual void onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_print.cpp b/hphp/runtime/eval/debugger/cmd/cmd_print.cpp index 5415f2b1b..e2b3f4ba3 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_print.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_print.cpp @@ -164,26 +164,26 @@ void CmdPrint::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_noBreak); } -void CmdPrint::list(DebuggerClient *client) { - if (client->arg(1, "clear")) { - client->addCompletion("all"); +void CmdPrint::list(DebuggerClient &client) { + if (client.arg(1, "clear")) { + client.addCompletion("all"); return; } - client->addCompletion(DebuggerClient::AutoCompleteCode); + client.addCompletion(DebuggerClient::AutoCompleteCode); - if (client->argCount() == 0) { - client->addCompletion(Formats); - client->addCompletion("always"); - client->addCompletion("list"); - client->addCompletion("clear"); - } else if (client->argCount() == 1 && client->arg(1, "always")) { - client->addCompletion(Formats); + if (client.argCount() == 0) { + client.addCompletion(Formats); + client.addCompletion("always"); + client.addCompletion("list"); + client.addCompletion("clear"); + } else if (client.argCount() == 1 && client.arg(1, "always")) { + client.addCompletion(Formats); } } -void CmdPrint::help(DebuggerClient *client) { - client->helpTitle("Print Command"); - client->helpCmds( +void CmdPrint::help(DebuggerClient &client) { + client.helpTitle("Print Command"); + client.helpCmds( "[p]rint {php}", "prints result of PHP code, (print_r)", "[p]rint v {php}", "prints result of PHP code, (var_dump)", "[p]rint x {php}", "prints hex encoded string or number", @@ -199,7 +199,7 @@ void CmdPrint::help(DebuggerClient *client) { "[p]rint [c]lear [a]ll", "clears all watch expressions", nullptr ); - client->helpBody( + client.helpBody( "Prints result of an expression in certain format. If '[a]lways' is " "specified, the expression will be added to a watch list. At every break, " "either at a breakpoint or caused by step commands, these expressions " @@ -207,47 +207,47 @@ void CmdPrint::help(DebuggerClient *client) { ); } -void CmdPrint::processList(DebuggerClient *client) { - DebuggerClient::WatchPtrVec &watches = client->getWatches(); +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, + client.print(" %d %s %s", i + 1, StringUtil::Pad(watches[i]->first, 8, " ", StringUtil::PadLeft).data(), watches[i]->second.c_str()); } if (watches.empty()) { - client->tutorial( + client.tutorial( "Use '[p]rint [a]lways ...' to set new watch expressions. " "Use '[p]rint ?|[h]elp' to read how to set them. " ); } else { - client->tutorial( + client.tutorial( "Use '[p]rint [c]lear {index}|[a]ll' to remove watch expression(s). " ); } } -void CmdPrint::processClear(DebuggerClient *client) { - DebuggerClient::WatchPtrVec &watches = client->getWatches(); +void CmdPrint::processClear(DebuggerClient &client) { + DebuggerClient::WatchPtrVec &watches = client.getWatches(); if (watches.empty()) { - client->error("There is no watch expression to clear."); - client->tutorial( + client.error("There is no watch expression to clear."); + client.tutorial( "Use '[p]rint [a]lways ...' to set new watch expressions. " "Use '[p]rint ?|[h]elp' to read how to set them. " ); return; } - if (client->arg(2, "all")) { + if (client.arg(2, "all")) { watches.clear(); - client->info("All watch expressions are cleared."); + client.info("All watch expressions are cleared."); return; } - string snum = client->argValue(2); + string snum = client.argValue(2); if (!DebuggerClient::IsValidNumber(snum)) { - client->error("'[p]rint [c]lear' needs an {index} argument."); - client->tutorial( + client.error("'[p]rint [c]lear' needs an {index} argument."); + client.tutorial( "You will have to run '[p]rint [l]ist' first to see a list of valid " "numbers or indices to specify." ); @@ -256,7 +256,7 @@ void CmdPrint::processClear(DebuggerClient *client) { int num = atoi(snum.c_str()) - 1; if (num < 0 || num >= (int)watches.size()) { - client->error("\"%s\" is not a valid index. Choose one from this list:", + client.error("\"%s\" is not a valid index. Choose one from this list:", snum.c_str()); processList(client); return; @@ -265,45 +265,45 @@ void CmdPrint::processClear(DebuggerClient *client) { watches.erase(watches.begin() + num); } -Variant CmdPrint::processWatch(DebuggerClient *client, const char *format, +Variant CmdPrint::processWatch(DebuggerClient &client, const char *format, const std::string &php) { m_body = php; - m_frame = client->getFrame(); + m_frame = client.getFrame(); m_noBreak = true; - CmdPrintPtr res = client->xend(this); + CmdPrintPtr res = client.xend(this); if (!res->m_output.empty()) { - client->output(res->m_output); + client.output(res->m_output); } return res->m_ret; } -void CmdPrint::handleReply(DebuggerClient *client) { +void CmdPrint::handleReply(DebuggerClient &client) { if (!m_output.empty()) { - client->output(m_output); + client.output(m_output); } - client->output(m_ret); + client.output(m_ret); } -void CmdPrint::onClientImpl(DebuggerClient *client) { +void CmdPrint::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { + if (client.argCount() == 0) { help(client); return; } int index = 1; - if (client->arg(1, "always")) { + if (client.arg(1, "always")) { m_isForWatch = true; - if (client->argCount() == 1) { - client->error("'[p]rint [a]lways' needs an expression to watch."); + if (client.argCount() == 1) { + client.error("'[p]rint [a]lways' needs an expression to watch."); return; } index++; - } else if (client->arg(1, "list")) { + } else if (client.arg(1, "list")) { m_isForWatch = true; processList(client); return; - } else if (client->arg(1, "clear")) { + } else if (client.arg(1, "clear")) { m_isForWatch = true; processClear(client); return; @@ -311,33 +311,33 @@ void CmdPrint::onClientImpl(DebuggerClient *client) { const char *format = nullptr; for (const char **fmt = Formats; *fmt; fmt++) { - if (client->arg(index, *fmt)) { + if (client.arg(index, *fmt)) { format = *fmt; index++; break; } } - m_body = client->lineRest(index); + m_body = client.lineRest(index); if (m_isForWatch) { - client->addWatch(format, m_body); + client.addWatch(format, m_body); return; } - m_bypassAccessCheck = client->getDebuggerBypassCheck(); - m_printLevel = client->getDebuggerPrintLevel(); + m_bypassAccessCheck = client.getDebuggerBypassCheck(); + m_printLevel = client.getDebuggerPrintLevel(); assert(m_printLevel <= 0 || m_printLevel >= DebuggerClient::MinPrintLevel); - m_frame = client->getFrame(); - CmdPrintPtr res = client->xend(this); + m_frame = client.getFrame(); + CmdPrintPtr res = client.xend(this); if (!res->is(m_type)) { - assert(client->isApiMode()); + assert(client.isApiMode()); m_incomplete = true; res->setClientOutput(client); } else { m_output = res->m_output; m_ret = res->m_ret; if (!m_output.empty()) { - client->output(m_output); + client.output(m_output); } - client->output(FormatResult(format, m_ret)); + client.output(FormatResult(format, m_ret)); } } @@ -347,12 +347,12 @@ static const StaticString s_body("body"); static const StaticString s_value_serialize("value_serialize"); static const StaticString s_value("value"); -void CmdPrint::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTValues); +void CmdPrint::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTValues); Array values; if (m_isForWatch) { // Manipulating the watch list, output the current list - DebuggerClient::WatchPtrVec &watches = client->getWatches(); + DebuggerClient::WatchPtrVec &watches = client.getWatches(); for (int i = 0; i < (int)watches.size(); i++) { ArrayInit watch(2); watch.set(s_format, watches[i]->first); @@ -362,29 +362,29 @@ void CmdPrint::setClientOutput(DebuggerClient *client) { } else { // Just print an expression, do similar output as eval values.set(s_body, m_body); - if (client->getDebuggerClientApiModeSerialize()) { + if (client.getDebuggerClientApiModeSerialize()) { values.set(s_value_serialize, DebuggerClient::FormatVariable(m_ret, 200)); } else { values.set(s_value, m_ret); } } - client->setOTValues(values); + client.setOTValues(values); } -bool CmdPrint::onServer(DebuggerProxy *proxy) { +bool CmdPrint::onServer(DebuggerProxy &proxy) { PCFilter* locSave = g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = new PCFilter(); g_vmContext->setDebuggerBypassCheck(m_bypassAccessCheck); { EvalBreakControl eval(m_noBreak); m_ret = DebuggerProxy::ExecutePHP(DebuggerProxy::MakePHPReturn(m_body), - m_output, !proxy->isLocal(), m_frame); + m_output, !proxy.isLocal(), m_frame); } g_vmContext->setDebuggerBypassCheck(false); delete g_vmContext->m_lastLocFilter; g_vmContext->m_lastLocFilter = locSave; - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_print.h b/hphp/runtime/eval/debugger/cmd/cmd_print.h index 4e5009c8d..e71f14fda 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_print.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_print.h @@ -32,19 +32,19 @@ public: CmdPrint() : DebuggerCommand(KindOfPrint), m_bypassAccessCheck(false), m_isForWatch(false), m_noBreak(false) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); - Variant processWatch(DebuggerClient *client, const char *format, + Variant processWatch(DebuggerClient &client, const char *format, const std::string &php); - virtual void handleReply(DebuggerClient *client); + virtual void handleReply(DebuggerClient &client); protected: - virtual void 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; - void processList(DebuggerClient *client); - void processClear(DebuggerClient *client); + void processList(DebuggerClient &client); + void processClear(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_quit.cpp b/hphp/runtime/eval/debugger/cmd/cmd_quit.cpp index db5b9d7f7..cc66eb562 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_quit.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_quit.cpp @@ -22,27 +22,27 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); // The text to display when the debugger client processes "help quit". -void CmdQuit::help(DebuggerClient *client) { +void CmdQuit::help(DebuggerClient &client) { TRACE(2, "CmdQuit::help\n"); - client->helpTitle("Quit Command"); - client->helpCmds( + client.helpTitle("Quit Command"); + client.helpCmds( "[q]uit", "quits this program", nullptr ); - client->helpBody( + client.helpBody( "After you type this command, you will not see me anymore." ); } // Carries out the Quit command by informing the server the client // is going away and then getting the client to quit. -void CmdQuit::onClientImpl(DebuggerClient *client) { +void CmdQuit::onClientImpl(DebuggerClient &client) { TRACE(2, "CmdQuit::onClientImpl\n"); if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { - client->sendToServer(this); - client->quit(); + if (client.argCount() == 0) { + client.sendToServer(this); + client.quit(); } else { help(client); } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_quit.h b/hphp/runtime/eval/debugger/cmd/cmd_quit.h index aa25f2a8f..093358417 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_quit.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_quit.h @@ -28,12 +28,12 @@ public: CmdQuit() : DebuggerCommand(KindOfQuit) {} // The text to display when the debugger client processes "help quit". - virtual void 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 void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); }; diff --git a/hphp/runtime/eval/debugger/cmd/cmd_run.cpp b/hphp/runtime/eval/debugger/cmd/cmd_run.cpp index 11465f393..59ad1cb24 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_run.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_run.cpp @@ -32,18 +32,18 @@ void CmdRun::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(*m_args); } -void CmdRun::list(DebuggerClient *client) { - client->addCompletion(DebuggerClient::AutoCompleteFileNames); +void CmdRun::list(DebuggerClient &client) { + client.addCompletion(DebuggerClient::AutoCompleteFileNames); } -void CmdRun::help(DebuggerClient *client) { - client->helpTitle("Run Command"); - client->helpCmds( +void CmdRun::help(DebuggerClient &client) { + client.helpTitle("Run Command"); + client.helpCmds( "[r]un", "restarts program", "[r]un {file} {arg1} {arg2} ...", "starts a new program", nullptr ); - client->helpBody( + client.helpBody( "Aborts current execution and restarts program with specified arguments. " "If no arguments are specified, it will reuse the PHP file and old " "arguments. If arguments are to be changed, please include file name, " @@ -54,18 +54,18 @@ void CmdRun::help(DebuggerClient *client) { ); } -void CmdRun::onClientImpl(DebuggerClient *client) { +void CmdRun::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - m_args = StringVecPtr(client->args(), null_deleter()); - m_smallStep = client->getDebuggerSmallStep(); - client->sendToServer(this); - client->clearCachedLocal(); - client->setFrame(0); + m_args = StringVecPtr(client.args(), null_deleter()); + m_smallStep = client.getDebuggerSmallStep(); + client.sendToServer(this); + client.clearCachedLocal(); + client.setFrame(0); throw DebuggerConsoleExitException(); } -bool CmdRun::onServer(DebuggerProxy *proxy) { +bool CmdRun::onServer(DebuggerProxy &proxy) { g_context->setDebuggerSmallStep(m_smallStep); throw DebuggerRestartException(m_args); } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_run.h b/hphp/runtime/eval/debugger/cmd/cmd_run.h index c4764211c..97ec68c86 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_run.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_run.h @@ -27,13 +27,13 @@ class CmdRun : public DebuggerCommand { public: CmdRun() : DebuggerCommand(KindOfRun) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_shell.cpp b/hphp/runtime/eval/debugger/cmd/cmd_shell.cpp index 81ec0f69b..0c15e98a5 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_shell.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_shell.cpp @@ -34,32 +34,32 @@ void CmdShell::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_out); } -void CmdShell::list(DebuggerClient *client) { - client->addCompletion(DebuggerClient::AutoCompleteFileNames); +void CmdShell::list(DebuggerClient &client) { + client.addCompletion(DebuggerClient::AutoCompleteFileNames); } -void CmdShell::help(DebuggerClient *client) { - client->helpTitle("Shell Command"); - client->help("! {cmd} {arg1} {arg2} ... remotely executes shell command"); - client->helpBody( +void CmdShell::help(DebuggerClient &client) { + client.helpTitle("Shell Command"); + client.help("! {cmd} {arg1} {arg2} ... remotely executes shell command"); + client.helpBody( "Executes the shell command on connected machine.\n" "\n" "The space between ! and command is not needed. '!ls' works as well." ); } -void CmdShell::onClientImpl(DebuggerClient *client) { +void CmdShell::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { + if (client.argCount() == 0) { help(client); return; } - m_args = *client->args(); - CmdShellPtr cmd = client->xend(this); - client->print(cmd->m_out); + m_args = *client.args(); + CmdShellPtr cmd = client.xend(this); + client.print(cmd->m_out); } -bool CmdShell::onServer(DebuggerProxy *proxy) { +bool CmdShell::onServer(DebuggerProxy &proxy) { const char **argv = (const char **)malloc((m_args.size() + 1) * sizeof(char*)); for (unsigned int i = 0; i < m_args.size(); i++) { @@ -68,7 +68,7 @@ bool CmdShell::onServer(DebuggerProxy *proxy) { argv[m_args.size()] = nullptr; Process::Exec(argv[0], argv, nullptr, m_out, &m_out, true); free(argv); - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_shell.h b/hphp/runtime/eval/debugger/cmd/cmd_shell.h index 4cb2ff59f..7082b51aa 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_shell.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_shell.h @@ -27,13 +27,13 @@ class CmdShell : public DebuggerCommand { public: CmdShell() : DebuggerCommand(KindOfShell) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_signal.cpp b/hphp/runtime/eval/debugger/cmd/cmd_signal.cpp index 7f9cb340c..79882ffe0 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_signal.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_signal.cpp @@ -31,13 +31,13 @@ void CmdSignal::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_signum); } -void CmdSignal::onClientImpl(DebuggerClient *client) { - m_signum = client->pollSignal(); - client->sendToServer(this); +void CmdSignal::onClientImpl(DebuggerClient &client) { + m_signum = client.pollSignal(); + client.sendToServer(this); } -bool CmdSignal::onServer(DebuggerProxy *proxy) { - return proxy->sendToClient(this); +bool CmdSignal::onServer(DebuggerProxy &proxy) { + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_signal.h b/hphp/runtime/eval/debugger/cmd/cmd_signal.h index 706a2cd98..053f21964 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_signal.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_signal.h @@ -36,10 +36,10 @@ public: Signal getSignal() const { return (Signal)m_signum;} - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_step.cpp b/hphp/runtime/eval/debugger/cmd/cmd_step.cpp index ae880e01d..afc1803f5 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_step.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_step.cpp @@ -21,32 +21,32 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdStep::help(DebuggerClient *client) { - client->helpTitle("Step Command"); - client->helpCmds( +void CmdStep::help(DebuggerClient &client) { + client.helpTitle("Step Command"); + client.helpCmds( "[s]tep {count=1}", "steps into lines of code", nullptr ); - client->helpBody( + client.helpBody( "Use this command at break to step into lines of code. Specify a " "count to step more than once." ); } -void CmdStep::onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdStep::onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt) { assert(!m_complete); // Complete cmds should not be asked to do work. CmdFlowControl::onSetup(proxy, interrupt); // Allows a breakpoint on this same line to be hit again when control returns // from function call. - BreakPointInfoPtr bp = proxy->getBreakPointAtCmd(interrupt); + BreakPointInfoPtr bp = proxy.getBreakPointAtCmd(interrupt); if (bp) { - bp->setBreakable(proxy->getRealStackDepth()); + bp->setBreakable(proxy.getRealStackDepth()); } installLocationFilterForLine(interrupt.getSite()); m_needsVMInterrupt = true; } -void CmdStep::onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt) { +void CmdStep::onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt) { m_complete = (decCount() == 0); if (!m_complete) { installLocationFilterForLine(interrupt.getSite()); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_step.h b/hphp/runtime/eval/debugger/cmd/cmd_step.h index 806797eb9..b7edb71af 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_step.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_step.h @@ -27,9 +27,9 @@ class CmdStep : public CmdFlowControl { public: CmdStep() : CmdFlowControl(KindOfStep) {} - virtual void help(DebuggerClient *client); - virtual void onSetup(DebuggerProxy *proxy, CmdInterrupt &interrupt); - virtual void onBeginInterrupt(DebuggerProxy *proxy, CmdInterrupt &interrupt); + virtual void help(DebuggerClient &client); + virtual void onSetup(DebuggerProxy &proxy, CmdInterrupt &interrupt); + virtual void onBeginInterrupt(DebuggerProxy &proxy, CmdInterrupt &interrupt); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_thread.cpp b/hphp/runtime/eval/debugger/cmd/cmd_thread.cpp index f2c80dd74..5b5227faa 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_thread.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_thread.cpp @@ -36,17 +36,17 @@ void CmdThread::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_threads); } -void CmdThread::list(DebuggerClient *client) { - if (client->argCount() == 0) { +void CmdThread::list(DebuggerClient &client) { + if (client.argCount() == 0) { static const char *keywords[] = { "list", "normal", "sticky", "exclusive", nullptr }; - client->addCompletion(keywords); + client.addCompletion(keywords); } } -void CmdThread::help(DebuggerClient *client) { - client->helpTitle("Thread Command"); - client->helpCmds( +void CmdThread::help(DebuggerClient &client) { + client.helpTitle("Thread Command"); + client.helpCmds( "[t]hread", "displays current thread's information", "[t]hread [l]ist", "lists all threads at break", "[t]hread {index}", "switches to the specified thread", @@ -55,7 +55,7 @@ void CmdThread::help(DebuggerClient *client) { "[t]hread [e]xclusive", "only break current thread", nullptr ); - client->helpBody( + client.helpBody( "Use '[t]hread' alone to display information of current thread.\n" "\n" "When a thread is at break, you may specify how other threads should " @@ -82,58 +82,58 @@ void CmdThread::help(DebuggerClient *client) { ); } -void CmdThread::processList(DebuggerClient *client, bool output /* = true */) { +void CmdThread::processList(DebuggerClient &client, bool output /* = true */) { m_body = "list"; - CmdThreadPtr res = client->xend(this); - client->updateThreads(res->m_threads); + CmdThreadPtr res = client.xend(this); + client.updateThreads(res->m_threads); if (!output) return; for (int i = 0; i < (int)res->m_threads.size(); i++) { DThreadInfoPtr thread = res->m_threads[i]; const char *flag = " "; - if (thread->m_id == client->getCurrentThreadId()) { + if (thread->m_id == client.getCurrentThreadId()) { flag = "*"; } - client->print("%4d %s %s (%lld) %s\n %s", thread->m_index, + client.print("%4d %s %s (%lld) %s\n %s", thread->m_index, flag, thread->m_type.c_str(), thread->m_id, thread->m_url.c_str(), thread->m_desc.c_str()); } } -void CmdThread::onClientImpl(DebuggerClient *client) { +void CmdThread::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() > 1) { + if (client.argCount() > 1) { help(client); return; } - if (client->argCount() == 0) { + if (client.argCount() == 0) { m_body = "info"; - CmdThreadPtr res = client->xend(this); - client->print(res->m_out); - } else if (client->arg(1, "list")) { + CmdThreadPtr res = client.xend(this); + client.print(res->m_out); + } else if (client.arg(1, "list")) { processList(client); - } else if (client->arg(1, "normal")) { + } else if (client.arg(1, "normal")) { m_body = "normal"; - client->sendToServer(this); - client->info("Thread is running in normal mode now. Other threads will " + client.sendToServer(this); + client.info("Thread is running in normal mode now. Other threads will " "interleave when they hit breakpoints as well."); - } else if (client->arg(1, "sticky")) { + } else if (client.arg(1, "sticky")) { m_body = "sticky"; - client->sendToServer(this); - client->info("Thread is running in sticky mode now. All other threads " + client.sendToServer(this); + client.info("Thread is running in sticky mode now. All other threads " "will wait until this thread finishes, when they hit " "breakpoints."); - } else if (client->arg(1, "exclusive")) { + } else if (client.arg(1, "exclusive")) { m_body = "exclusive"; - client->sendToServer(this); - client->info("Thread is running in exclusive mode now. All other threads " + client.sendToServer(this); + client.info("Thread is running in exclusive mode now. All other threads " "will not break, even when they hit breakpoints."); } else { - string snum = client->argValue(1); + string snum = client.argValue(1); if (!DebuggerClient::IsValidNumber(snum)) { - client->error("'[t]hread {index}' needs a numeric argument."); - client->tutorial( + client.error("'[t]hread {index}' needs a numeric argument."); + client.tutorial( "You will have to run '[t]hread [l]ist' first to see a list of valid " "numbers or indices to specify. Thread 1 is always your current " "thread. If that's the only thread on the list, you do not have " @@ -143,26 +143,26 @@ void CmdThread::onClientImpl(DebuggerClient *client) { } int num = atoi(snum.c_str()); - DThreadInfoPtr thread = client->getThread(num); + DThreadInfoPtr thread = client.getThread(num); if (!thread) { processList(client, false); - thread = client->getThread(num); + thread = client.getThread(num); if (!thread) { - client->error("\"%s\" is not a valid thread index. Choose one from " + client.error("\"%s\" is not a valid thread index. Choose one from " "this list:", snum.c_str()); processList(client); return; } } - if (thread->m_id == client->getCurrentThreadId()) { - client->info("This is your current thread already."); + if (thread->m_id == client.getCurrentThreadId()) { + client.info("This is your current thread already."); return; } m_body = "switch"; m_threads.push_back(thread); - client->sendToServer(this); + client.sendToServer(this); throw DebuggerConsoleExitException(); } } @@ -175,7 +175,7 @@ void CmdThread::debuggerInfo(InfoVec &info) { Add(info, "Thread ID", FormatNumber("0x%llx", (int64_t)Process::GetThreadId())); } -bool CmdThread::onServer(DebuggerProxy *proxy) { +bool CmdThread::onServer(DebuggerProxy &proxy) { if (m_body == "info") { // collect info InfoVec info; @@ -184,36 +184,36 @@ bool CmdThread::onServer(DebuggerProxy *proxy) { if (transport) { transport->debuggerInfo(info); } else { - Add(info, "Thread Type", proxy->getThreadType()); + Add(info, "Thread Type", proxy.getThreadType()); } g_context->debuggerInfo(info); m_out = DebuggerClient::FormatInfoVec(info); - return proxy->sendToClient(this); + return proxy.sendToClient(this); } if (m_body == "list") { - proxy->getThreads(m_threads); - return proxy->sendToClient(this); + proxy.getThreads(m_threads); + return proxy.sendToClient(this); } if (m_body == "switch") { if (!m_threads.empty()) { - proxy->switchThread(m_threads[0]); + proxy.switchThread(m_threads[0]); m_exitInterrupt = true; return true; } } if (m_body == "normal") { - proxy->switchThreadMode(DebuggerProxy::Normal); + proxy.switchThreadMode(DebuggerProxy::Normal); return true; } if (m_body == "sticky") { - proxy->switchThreadMode(DebuggerProxy::Sticky); + proxy.switchThreadMode(DebuggerProxy::Sticky); return true; } if (m_body == "exclusive") { - proxy->switchThreadMode(DebuggerProxy::Exclusive); + proxy.switchThreadMode(DebuggerProxy::Exclusive); return true; } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_thread.h b/hphp/runtime/eval/debugger/cmd/cmd_thread.h index 0ba44b6f8..30c9e1b93 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_thread.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_thread.h @@ -28,13 +28,13 @@ class CmdThread : public DebuggerCommand, public IDebuggable { public: CmdThread() : DebuggerCommand(KindOfThread) {} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); @@ -45,7 +45,7 @@ private: String m_out; DThreadInfoPtrVec m_threads; - void processList(DebuggerClient *client, bool output = true); + void processList(DebuggerClient &client, bool output = true); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_up.cpp b/hphp/runtime/eval/debugger/cmd/cmd_up.cpp index c4942db6e..d18d45ee9 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_up.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_up.cpp @@ -22,25 +22,25 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdUp::help(DebuggerClient *client) { - client->helpTitle("Up Command"); - client->helpCmds( +void CmdUp::help(DebuggerClient &client) { + client.helpTitle("Up Command"); + client.helpCmds( "[u]p {num=1}", "moves to outer frames (callers) on stacktrace", nullptr ); - client->helpBody( + client.helpBody( "Use this command to walk up on stacktrace to find out outer callers of " "current frame. By default it moves up by one level. Specify a number " "to move up several levels a time." ); } -int CmdUp::ParseNumber(DebuggerClient *client) { - if (client->argCount() == 1) { - string snum = client->argValue(1); +int CmdUp::ParseNumber(DebuggerClient &client) { + if (client.argCount() == 1) { + string snum = client.argValue(1); if (!DebuggerClient::IsValidNumber(snum)) { - client->error("Please specify a number."); - client->tutorial( + client.error("Please specify a number."); + client.tutorial( "Run '[w]here' command to see the entire stacktrace." ); return true; @@ -50,18 +50,18 @@ int CmdUp::ParseNumber(DebuggerClient *client) { return 1; } -void CmdUp::onClientImpl(DebuggerClient *client) { +void CmdUp::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() > 1) { + if (client.argCount() > 1) { help(client); } else { CmdWhere().fetchStackTrace(client); - client->moveToFrame(client->getFrame() + ParseNumber(client)); + client.moveToFrame(client.getFrame() + ParseNumber(client)); } } -void CmdUp::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTStacktrace); +void CmdUp::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTStacktrace); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_up.h b/hphp/runtime/eval/debugger/cmd/cmd_up.h index 5cf898be5..c4e65f4a0 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_up.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_up.h @@ -25,16 +25,16 @@ namespace HPHP { namespace Eval { DECLARE_BOOST_TYPES(CmdUp); class CmdUp : public DebuggerCommand { public: - static int ParseNumber(DebuggerClient *client); + static int ParseNumber(DebuggerClient &client); public: CmdUp() : DebuggerCommand(KindOfUp) {} - virtual void help(DebuggerClient *client); - virtual void setClientOutput(DebuggerClient *client); + virtual void help(DebuggerClient &client); + virtual void setClientOutput(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); }; diff --git a/hphp/runtime/eval/debugger/cmd/cmd_user.cpp b/hphp/runtime/eval/debugger/cmd/cmd_user.cpp index 509d2e2bc..95b3fe414 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_user.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_user.cpp @@ -37,15 +37,15 @@ void CmdUser::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_cmd); } -void CmdUser::list(DebuggerClient *client) { +void CmdUser::list(DebuggerClient &client) { Lock lock(s_mutex); CmdExtended::list(client); } -void CmdUser::help(DebuggerClient *client) { - client->helpTitle("User Extended Command"); +void CmdUser::help(DebuggerClient &client) { + client.helpTitle("User Extended Command"); helpImpl(client, "y"); - client->helpBody( + client.helpBody( "These commands are implemented and installed in PHP by implementing " "DebuggerCommand and calling hphpd_install_user_command(). For example\n" "\n" @@ -75,18 +75,18 @@ const ExtendedCommandMap &CmdUser::getCommandMap() { return s_commands; } -void CmdUser::invokeList(DebuggerClient *client, const std::string &cls) { +void CmdUser::invokeList(DebuggerClient &client, const std::string &cls) { p_DebuggerClientCmdUser pclient(NEWOBJ(c_DebuggerClientCmdUser)()); - pclient->m_client = client; + pclient->m_client = &client; try { Object cmd = create_object(cls.c_str(), null_array); cmd->o_invoke_few_args(s_onAutoComplete, 1, pclient); } catch (...) {} } -bool CmdUser::invokeHelp(DebuggerClient *client, const std::string &cls) { +bool CmdUser::invokeHelp(DebuggerClient &client, const std::string &cls) { p_DebuggerClientCmdUser pclient(NEWOBJ(c_DebuggerClientCmdUser)()); - pclient->m_client = client; + pclient->m_client = &client; try { Object cmd = create_object(cls.c_str(), null_array); Variant ret = cmd->o_invoke_few_args(s_help, 1, pclient); @@ -95,9 +95,9 @@ bool CmdUser::invokeHelp(DebuggerClient *client, const std::string &cls) { return false; } -bool CmdUser::invokeClient(DebuggerClient *client, const std::string &cls) { +bool CmdUser::invokeClient(DebuggerClient &client, const std::string &cls) { p_DebuggerClientCmdUser pclient(NEWOBJ(c_DebuggerClientCmdUser)()); - pclient->m_client = client; + pclient->m_client = &client; try { Object cmd = create_object(cls.c_str(), null_array); Variant ret = cmd->o_invoke_few_args(s_onClient, 1, pclient); @@ -106,10 +106,10 @@ bool CmdUser::invokeClient(DebuggerClient *client, const std::string &cls) { return false; } -bool CmdUser::onServer(DebuggerProxy *proxy) { +bool CmdUser::onServer(DebuggerProxy &proxy) { if (m_cmd.isNull()) return false; p_DebuggerProxyCmdUser pproxy(NEWOBJ(c_DebuggerProxyCmdUser)()); - pproxy->m_proxy = proxy; + pproxy->m_proxy = &proxy; try { Variant ret = m_cmd->o_invoke_few_args(s_onServer, 1, pproxy); return !same(ret, false); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_user.h b/hphp/runtime/eval/debugger/cmd/cmd_user.h index d10ad2535..058df0088 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_user.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_user.h @@ -39,14 +39,14 @@ public: Object getUserCommand() { return m_cmd;} - virtual void list(DebuggerClient *client); - virtual void help(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void list(DebuggerClient &client); + virtual void help(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); virtual const ExtendedCommandMap &getCommandMap(); - virtual void invokeList(DebuggerClient *client, const std::string &cls); - virtual bool invokeHelp(DebuggerClient *client, const std::string &cls); - virtual bool invokeClient(DebuggerClient *client, const std::string &cls); + virtual void invokeList(DebuggerClient &client, const std::string &cls); + virtual bool invokeHelp(DebuggerClient &client, const std::string &cls); + virtual bool invokeClient(DebuggerClient &client, const std::string &cls); protected: virtual void sendImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_variable.cpp b/hphp/runtime/eval/debugger/cmd/cmd_variable.cpp index 9ed13a637..0a83cb566 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_variable.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_variable.cpp @@ -48,14 +48,14 @@ void CmdVariable::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_global); } -void CmdVariable::help(DebuggerClient *client) { - client->helpTitle("Variable Command"); - client->helpCmds( +void CmdVariable::help(DebuggerClient &client) { + client.helpTitle("Variable Command"); + client.helpCmds( "[v]ariable", "lists all local variables on stack", "[v]ariable {text}", "full-text search local variables", nullptr ); - client->helpBody( + client.helpBody( "This will print names and values of all variables that are currently " "accessible by simple names. Use '[w]here', '[u]p {num}', '[d]own {num}', " "'[f]rame {index}' commands to choose a different frame to view variables " @@ -67,7 +67,7 @@ void CmdVariable::help(DebuggerClient *client) { ); } -void CmdVariable::PrintVariables(DebuggerClient *client, CArrRef variables, +void CmdVariable::PrintVariables(DebuggerClient &client, CArrRef variables, bool global, CStrRef text) { bool system = true; int i = 0; @@ -79,26 +79,26 @@ void CmdVariable::PrintVariables(DebuggerClient *client, CArrRef variables, String fullvalue = DebuggerClient::FormatVariable(iter.second(), -1); if (name.find(text, 0, false) >= 0 || fullvalue.find(text, 0, false) >= 0) { - client->print("%s = %s", name.data(), value.data()); + client.print("%s = %s", name.data(), value.data()); found = true; } } else { if (global && system) { - client->print("$%s = %s", name.data(), value.data()); + client.print("$%s = %s", name.data(), value.data()); } else { - client->output("$%s = %s", name.data(), value.data()); + client.output("$%s = %s", name.data(), value.data()); } // we knew this is the last system global if (global && name == "http_response_header") { - client->output(""); + client.output(""); system = false; } ++i; - if (!client->isApiMode() && + if (!client.isApiMode() && i % DebuggerClient::ScrollBlockSize == 0 && - client->ask("There are %d more variables. Continue? [Y/n]", + client.ask("There are %d more variables. Continue? [Y/n]", variables.size() - i) == 'n') { break; } @@ -106,44 +106,44 @@ void CmdVariable::PrintVariables(DebuggerClient *client, CArrRef variables, } if (!text.empty() && !found) { - client->info("(unable to find specified text in any variables)"); + client.info("(unable to find specified text in any variables)"); } } -void CmdVariable::onClientImpl(DebuggerClient *client) { +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) { + if (client.argCount() == 1) { + text = client.argValue(1); + } else if (client.argCount() != 0) { help(client); return; } - m_frame = client->getFrame(); - CmdVariablePtr cmd = client->xend(this); + m_frame = client.getFrame(); + CmdVariablePtr cmd = client.xend(this); if (cmd->m_variables.empty()) { - client->info("(no variable was defined)"); + client.info("(no variable was defined)"); } else { m_variables = cmd->m_variables; PrintVariables(client, cmd->m_variables, cmd->m_global, text); } } -void CmdVariable::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTValues); +void CmdVariable::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTValues); Array values; for (ArrayIter iter(m_variables); iter; ++iter) { String name = iter.first().toString(); - if (client->getDebuggerClientApiModeSerialize()) { + if (client.getDebuggerClientApiModeSerialize()) { values.set(name, DebuggerClient::FormatVariable(iter.second(), 200)); } else { values.set(name, iter.second()); } } - client->setOTValues(values); + client.setOTValues(values); } static const StaticString s_GLOBALS("GLOBALS"); @@ -154,9 +154,9 @@ Array CmdVariable::GetGlobalVariables() { return ret; } -bool CmdVariable::onServer(DebuggerProxy *proxy) { +bool CmdVariable::onServer(DebuggerProxy &proxy) { m_variables = g_vmContext->getLocalDefinedVariables(m_frame); - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_variable.h b/hphp/runtime/eval/debugger/cmd/cmd_variable.h index 23978a5d6..764e86f53 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_variable.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_variable.h @@ -26,19 +26,19 @@ DECLARE_BOOST_TYPES(CmdVariable); class CmdVariable : public DebuggerCommand { public: static Array GetGlobalVariables(); - static void PrintVariables(DebuggerClient *client, CArrRef variables, + static void PrintVariables(DebuggerClient &client, CArrRef variables, bool global, CStrRef text); public: CmdVariable() : DebuggerCommand(KindOfVariable) {} - virtual void help(DebuggerClient *client); + virtual void help(DebuggerClient &client); - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_where.cpp b/hphp/runtime/eval/debugger/cmd/cmd_where.cpp index 02d16a4e9..b6cacbff5 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_where.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_where.cpp @@ -46,83 +46,83 @@ void CmdWhere::recvImpl(DebuggerThriftBuffer &thrift) { thrift.read(m_stackArgs); } -void CmdWhere::help(DebuggerClient *client) { - client->helpTitle("Where Command"); - client->helpCmds( +void CmdWhere::help(DebuggerClient &client) { + client.helpTitle("Where Command"); + client.helpCmds( "[w]here", "displays current stacktrace", "[w]here {num}", "displays number of innermost frames", "[w]here -{num}", "displays number of outermost frames", nullptr ); - client->helpBody( + client.helpBody( "Use '[u]p {num}' or '[d]own {num}' to walk up or down the stacktrace. " "Use '[f]rame {index}' to jump to one particular frame. At any frame, " "use '[v]ariable' command to display all local variables." ); } -Array CmdWhere::fetchStackTrace(DebuggerClient *client) { - Array st = client->getStackTrace(); +Array CmdWhere::fetchStackTrace(DebuggerClient &client) { + Array st = client.getStackTrace(); if (st.isNull()) { - m_stackArgs = client->getDebuggerStackArgs(); - CmdWherePtr cmd = client->xend(this); + m_stackArgs = client.getDebuggerStackArgs(); + CmdWherePtr cmd = client.xend(this); st = cmd->m_stacktrace; - client->setStackTrace(st); + client.setStackTrace(st); } return st; } -void CmdWhere::onClientImpl(DebuggerClient *client) { +void CmdWhere::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() > 1) { + if (client.argCount() > 1) { help(client); return; } Array st = fetchStackTrace(client); if (st.empty()) { - client->info("(no stacktrace to display or in global scope)"); - client->info("if you hit serialization limit, consider do " + 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; } // so list command can default to current frame - client->moveToFrame(client->getFrame(), false); + client.moveToFrame(client.getFrame(), false); - if (client->argCount() == 0) { + if (client.argCount() == 0) { int i = 0; for (ArrayIter iter(st); iter; ++iter) { - client->printFrame(i, iter.second()); + client.printFrame(i, iter.second()); ++i; - if (!client->isApiMode() && + if (!client.isApiMode() && i % DebuggerClient::ScrollBlockSize == 0 && - client->ask("There are %d more frames. Continue? [Y/n]", + client.ask("There are %d more frames. Continue? [Y/n]", st.size() - i) == 'n') { break; } } } else { - string snum = client->argValue(1); + string snum = client.argValue(1); int num = atoi(snum.c_str()); if (snum[0] == '-') { snum = snum.substr(1); } if (!DebuggerClient::IsValidNumber(snum)) { - client->error("The argument, if specified, has to be numeric."); + client.error("The argument, if specified, has to be numeric."); return; } if (num > 0) { for (int i = 0; i < num && i < st.size(); i++) { - client->printFrame(i, st[i]); + client.printFrame(i, st[i]); } } else if (num < 0) { for (int i = st.size() + num; i < st.size(); i++) { - client->printFrame(i, st[i]); + client.printFrame(i, st[i]); } } else { - client->error("0 was specified for the number of frames"); - client->tutorial( + client.error("0 was specified for the number of frames"); + client.tutorial( "The optional argument is the number of frames to print out. " "Use a positive number to print out innermost frames. Use a negative " "number to print out outermost frames." @@ -131,8 +131,8 @@ void CmdWhere::onClientImpl(DebuggerClient *client) { } } -void CmdWhere::setClientOutput(DebuggerClient *client) { - client->setOutputType(DebuggerClient::OTStacktrace); +void CmdWhere::setClientOutput(DebuggerClient &client) { + client.setOutputType(DebuggerClient::OTStacktrace); } void CmdWhere::processStackTrace() { @@ -153,12 +153,12 @@ void CmdWhere::processStackTrace() { m_stacktrace = smallST; } -bool CmdWhere::onServer(DebuggerProxy *proxy) { +bool CmdWhere::onServer(DebuggerProxy &proxy) { m_stacktrace = g_vmContext->debugBacktrace(false, true, false); if (!m_stackArgs) { processStackTrace(); } - return proxy->sendToClient(this); + return proxy.sendToClient(this); } /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/cmd/cmd_where.h b/hphp/runtime/eval/debugger/cmd/cmd_where.h index d20d8dd3f..eeea33d4e 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_where.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_where.h @@ -27,16 +27,16 @@ class CmdWhere : public DebuggerCommand { public: CmdWhere() : DebuggerCommand(KindOfWhere), m_stackArgs(true) {} - virtual void help(DebuggerClient *client); + virtual void help(DebuggerClient &client); - virtual void setClientOutput(DebuggerClient *client); - virtual bool onServer(DebuggerProxy *proxy); + virtual void setClientOutput(DebuggerClient &client); + virtual bool onServer(DebuggerProxy &proxy); - Array fetchStackTrace(DebuggerClient *client); // client side + Array fetchStackTrace(DebuggerClient &client); // client side void processStackTrace(); // server side protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); virtual void sendImpl(DebuggerThriftBuffer &thrift); virtual void recvImpl(DebuggerThriftBuffer &thrift); diff --git a/hphp/runtime/eval/debugger/cmd/cmd_zend.cpp b/hphp/runtime/eval/debugger/cmd/cmd_zend.cpp index 91e821fd5..732aff116 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_zend.cpp +++ b/hphp/runtime/eval/debugger/cmd/cmd_zend.cpp @@ -22,13 +22,13 @@ namespace HPHP { namespace Eval { TRACE_SET_MOD(debugger); -void CmdZend::help(DebuggerClient *client) { - client->helpTitle("Zend Command"); - client->helpCmds( +void CmdZend::help(DebuggerClient &client) { + client.helpTitle("Zend Command"); + client.helpCmds( "[z]end", "running the most recent code snippet in Zend PHP", nullptr ); - client->helpBody( + client.helpBody( "This is mainly for comparing results from PHP vs. HipHop. After you type " "in some PHP code, it will be evaluated immediately in HipHop. Then you " "can type '[z]end' command to re-run the same script in Zend PHP. Please " @@ -37,14 +37,14 @@ void CmdZend::help(DebuggerClient *client) { ); } -void CmdZend::onClientImpl(DebuggerClient *client) { +void CmdZend::onClientImpl(DebuggerClient &client) { if (DebuggerCommand::displayedHelp(client)) return; - if (client->argCount() == 0) { - const std::string &code = client->getCode(); + 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); + client.print(out); } else { help(client); } diff --git a/hphp/runtime/eval/debugger/cmd/cmd_zend.h b/hphp/runtime/eval/debugger/cmd/cmd_zend.h index 43456dd99..fa8e156b7 100644 --- a/hphp/runtime/eval/debugger/cmd/cmd_zend.h +++ b/hphp/runtime/eval/debugger/cmd/cmd_zend.h @@ -27,10 +27,10 @@ class CmdZend : public DebuggerCommand { public: CmdZend() : DebuggerCommand(KindOfZend) {} - virtual void help(DebuggerClient *client); + virtual void help(DebuggerClient &client); protected: - virtual void onClientImpl(DebuggerClient *client); + virtual void onClientImpl(DebuggerClient &client); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/hphp/runtime/eval/debugger/debugger_client.cpp b/hphp/runtime/eval/debugger/debugger_client.cpp index 1289b8cff..f157ae1ed 100644 --- a/hphp/runtime/eval/debugger/debugger_client.cpp +++ b/hphp/runtime/eval/debugger/debugger_client.cpp @@ -708,7 +708,7 @@ void DebuggerClient::run() { void DebuggerClient::updateLiveLists() { TRACE(2, "DebuggerClient::updateLiveLists\n"); ReadlineWaitCursor waitCursor; - CmdInfo::UpdateLiveLists(this); + CmdInfo::UpdateLiveLists(*this); m_acLiveListsDirty = false; } @@ -740,7 +740,7 @@ void DebuggerClient::promptFunctionPrototype() { } } - String output = highlight_code(CmdInfo::GetProtoType(this, cls, func)); + String output = highlight_code(CmdInfo::GetProtoType(*this, cls, func)); print("\n%s", output.data()); rl_forced_update_display(); } @@ -891,7 +891,7 @@ char *DebuggerClient::getCompletion(const char *text, int state) { if (cmd) { if (cmd->is(DebuggerCommand::KindOfRun)) playMacro("startup"); DebuggerCommandPtr deleter(cmd); - cmd->list(this); + cmd->list(*this); } } break; @@ -943,14 +943,14 @@ bool DebuggerClient::initializeMachine() { if (!m_machine->m_initialized) { // set/clear intercept for RPC thread if (!m_machines.empty() && m_machine == m_machines[0]) { - CmdMachine::UpdateIntercept(this, m_machine->m_rpcHost, + CmdMachine::UpdateIntercept(*this, m_machine->m_rpcHost, m_machine->m_rpcPort); } // upload breakpoints if (!m_breakpoints.empty()) { info("Updating breakpoints..."); - CmdBreak::SendClientBreakpointListToServer(this); + CmdBreak::SendClientBreakpointListToServer(*this); } // attaching to default sandbox @@ -959,7 +959,7 @@ bool DebuggerClient::initializeMachine() { const char *user = m_options.user.empty() ? nullptr : m_options.user.c_str(); m_machine->m_sandboxAttached = (waitForgSandbox = - CmdMachine::AttachSandbox(this, user, m_options.sandbox.c_str())); + CmdMachine::AttachSandbox(*this, user, m_options.sandbox.c_str())); if (!m_machine->m_sandboxAttached) { Logger::Error("Unable to communicate with default sandbox."); } @@ -985,7 +985,7 @@ DebuggerCommandPtr DebuggerClient::waitForNextInterrupt() { return DebuggerCommandPtr(); } if (cmd->is(DebuggerCommand::KindOfSignal)) { - cmd->onClient(this); + cmd->onClient(*this); continue; } if (!cmd->is(DebuggerCommand::KindOfInterrupt)) { @@ -1024,7 +1024,7 @@ void DebuggerClient::runImpl() { throw DebuggerServerLostException(); } if (cmd->is(DebuggerCommand::KindOfSignal)) { - cmd->onClient(this); + cmd->onClient(*this); continue; } if (!cmd->is(DebuggerCommand::KindOfInterrupt)) { @@ -1034,7 +1034,7 @@ void DebuggerClient::runImpl() { m_sigTime = 0; usageLogInterrupt(cmd); { - cmd->onClient(this); + cmd->onClient(*this); } m_machine->m_interrupting = true; setClientState(StateReadyForCommand); @@ -1198,7 +1198,7 @@ Array DebuggerClient::getOutputArray() { void DebuggerClient::shortCode(BreakPointInfoPtr bp) { TRACE(2, "DebuggerClient::shortCode\n"); if (bp && !bp->m_file.empty() && bp->m_line1) { - Variant source = CmdList::GetSourceFile(this, bp->m_file); + Variant source = CmdList::GetSourceFile(*this, bp->m_file); if (source.isString()) { // Line and column where highlight should start and end int beginHighlightLine = bp->m_line1; @@ -1630,7 +1630,7 @@ bool DebuggerClient::process() { case '?': { if (match("?")) { usageLog("help", m_line); - CmdHelp().onClient(this); + CmdHelp().onClient(*this); return true; } if (match("?>")) { @@ -1645,7 +1645,7 @@ bool DebuggerClient::process() { usageLog(m_commandCanonical, m_line); if (cmd->is(DebuggerCommand::KindOfRun)) playMacro("startup"); DebuggerCommandPtr deleter(cmd); - cmd->onClient(this); + cmd->onClient(*this); } else { processTakeCode(); } @@ -1854,7 +1854,7 @@ DebuggerCommandPtr DebuggerClient::recvFromServer(int expected) { } // eval() can cause more breakpoints - res->onClient(this); + res->onClient(*this); if (!console()) { if (m_quitting) { throw DebuggerClientExitException(); @@ -1934,7 +1934,7 @@ void DebuggerClient::processEval() { m_runState = Running; m_inputState = TakingCommand; m_acLiveListsDirty = true; - CmdEval().onClient(this); + CmdEval().onClient(*this); } void DebuggerClient::swapHelp() { diff --git a/hphp/runtime/eval/debugger/debugger_command.cpp b/hphp/runtime/eval/debugger/debugger_command.cpp index 040916cf4..4a21c8a25 100644 --- a/hphp/runtime/eval/debugger/debugger_command.cpp +++ b/hphp/runtime/eval/debugger/debugger_command.cpp @@ -145,11 +145,11 @@ bool DebuggerCommand::Receive(DebuggerThriftBuffer &thrift, /////////////////////////////////////////////////////////////////////////////// // default handlers -void DebuggerCommand::list(DebuggerClient *client) { +void DebuggerCommand::list(DebuggerClient &client) { TRACE(2, "DebuggerCommand::list\n"); } -void DebuggerCommand::help(DebuggerClient *client) { +void DebuggerCommand::help(DebuggerClient &client) { TRACE(2, "DebuggerCommand::help\n"); assert(false); } @@ -157,30 +157,30 @@ void DebuggerCommand::help(DebuggerClient *client) { // 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::displayedHelp(DebuggerClient *client) { - TRACE(2, "DebuggerCommand::onClientImpl\n"); - if (client->arg(1, "help") || client->arg(1, "?")) { +bool DebuggerCommand::displayedHelp(DebuggerClient &client) { + TRACE(2, "DebuggerCommand::displayedHelp\n"); + if (client.arg(1, "help") || client.arg(1, "?")) { help(client); return true; } return false; } -void DebuggerCommand::onClient(DebuggerClient *client) { +void DebuggerCommand::onClient(DebuggerClient &client) { TRACE(2, "DebuggerCommand::onClient\n"); onClientImpl(client); - if (client->isApiMode() && !m_incomplete) { + if (client.isApiMode() && !m_incomplete) { setClientOutput(client); } } -void DebuggerCommand::setClientOutput(DebuggerClient *client) { +void DebuggerCommand::setClientOutput(DebuggerClient &client) { TRACE(2, "DebuggerCommand::setClientOutput\n"); // Just default to text - client->setOutputType(DebuggerClient::OTText); + client.setOutputType(DebuggerClient::OTText); } -bool DebuggerCommand::onServer(DebuggerProxy *proxy) { +bool DebuggerCommand::onServer(DebuggerProxy &proxy) { TRACE(2, "DebuggerCommand::onServer\n"); assert(false); Logger::Error("DebuggerCommand::onServer(): bad cmd type: %d", m_type); diff --git a/hphp/runtime/eval/debugger/debugger_command.h b/hphp/runtime/eval/debugger/debugger_command.h index ec307c01b..f59db9e79 100644 --- a/hphp/runtime/eval/debugger/debugger_command.h +++ b/hphp/runtime/eval/debugger/debugger_command.h @@ -100,31 +100,31 @@ public: // Informs the client of all strings that may follow a break command. // Used for auto completion. The client uses the prefix of the argument // following the command to narrow down the list displayed to the user. - virtual void list(DebuggerClient *client); + virtual void list(DebuggerClient &client); // The text to display when the debugger client // processes "help ". - virtual void help(DebuggerClient *client); + virtual void help(DebuggerClient &client); // 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. - void 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 // be accessed via the debugger client API exposed to PHP programs. - virtual void setClientOutput(DebuggerClient *client); + virtual void setClientOutput(DebuggerClient &client); // Server-side work for a command. Returning false indicates a failure to // communicate with the client (for commands that do so). - virtual bool onServer(DebuggerProxy *proxy); + virtual bool onServer(DebuggerProxy &proxy); // This seems to be confined to eval and print commands. // It is not clear that it belongs in this interface or that the // assert is safe. - virtual void handleReply(DebuggerClient *client) { assert(false); } + virtual void handleReply(DebuggerClient &client) { assert(false); } // Returns true if DebuggerProxy::processInterrupt() should return // to its caller instead of processing further commands from the client. @@ -136,12 +136,12 @@ public: protected: // Carries out the command, possibly by sending it to the server. - virtual void onClientImpl(DebuggerClient *client) = 0; + 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); + bool displayedHelp(DebuggerClient &client); // Always called from send and must implement the subclass specific // logic for serializing a command to send via Thrift. diff --git a/hphp/runtime/eval/debugger/debugger_proxy.cpp b/hphp/runtime/eval/debugger/debugger_proxy.cpp index 2ba7562b2..9e0b7abd7 100644 --- a/hphp/runtime/eval/debugger/debugger_proxy.cpp +++ b/hphp/runtime/eval/debugger/debugger_proxy.cpp @@ -350,7 +350,7 @@ void DebuggerProxy::pollSignal() { // Send CmdSignal over to the client and wait for a response. CmdSignal cmd; - if (!cmd.onServer(this)) { + if (!cmd.onServer(*this)) { TRACE_RB(2, "DebuggerProxy::pollSignal: " "Failed to send CmdSignal to client\n"); break; @@ -541,7 +541,7 @@ bool DebuggerProxy::checkFlowBreak(CmdInterrupt &cmd) { cmd.getInterruptType() == HardBreakPoint || cmd.getInterruptType() == ExceptionThrown) && m_flow) { if (!m_flow->is(DebuggerCommand::KindOfContinue)) { - m_flow->onBeginInterrupt(this, cmd); + m_flow->onBeginInterrupt(*this, cmd); if (m_flow->complete()) { fcShouldBreak = true; m_flow.reset(); @@ -561,7 +561,7 @@ bool DebuggerProxy::checkFlowBreak(CmdInterrupt &cmd) { if ((cmd.getInterruptType() == BreakPointReached || cmd.getInterruptType() == HardBreakPoint) && m_flow) { if (m_flow->is(DebuggerCommand::KindOfContinue)) { - m_flow->onBeginInterrupt(this, cmd); + m_flow->onBeginInterrupt(*this, cmd); if (m_flow->complete()) m_flow.reset(); return false; } @@ -581,7 +581,7 @@ void DebuggerProxy::checkStop() { void DebuggerProxy::processInterrupt(CmdInterrupt &cmd) { TRACE_RB(2, "DebuggerProxy::processInterrupt\n"); // Do the server-side work for this interrupt, which just notifies the client. - if (!cmd.onServer(this)) { + if (!cmd.onServer(*this)) { TRACE_RB(1, "Failed to send CmdInterrupt to client\n"); Debugger::RemoveProxy(shared_from_this()); // on socket error return; @@ -602,7 +602,7 @@ void DebuggerProxy::processInterrupt(CmdInterrupt &cmd) { // Any control flow command gets installed here and we continue execution. m_flow = dynamic_pointer_cast(res); if (m_flow) { - m_flow->onSetup(this, cmd); + m_flow->onSetup(*this, cmd); if (!m_flow->complete()) { TRACE_RB(2, "Incomplete flow command %d remaining on proxy for " "further processing\n", m_flow->getType()); @@ -628,7 +628,7 @@ void DebuggerProxy::processInterrupt(CmdInterrupt &cmd) { try { // Perform the server-side work for this command. if (res) { - if (!res->onServer(this)) { + if (!res->onServer(*this)) { TRACE_RB(1, "Failed to execute cmd %d from client\n", res->getType()); cmdFailure = true; } diff --git a/hphp/runtime/ext/ext_debugger.cpp b/hphp/runtime/ext/ext_debugger.cpp index 924744b73..f492be3ef 100644 --- a/hphp/runtime/ext/ext_debugger.cpp +++ b/hphp/runtime/ext/ext_debugger.cpp @@ -190,40 +190,40 @@ void c_DebuggerClientCmdUser::t_quit() { m_client->quit(); } -static String format_string(DebuggerClient *client, +static String format_string(DebuggerClient &client, int _argc, CStrRef format, CArrRef _argv) { Variant ret = f_sprintf(_argc, format, _argv); if (ret.isString()) { return ret; } - client->error("Debugger extension failed to format string: %s", + client.error("Debugger extension failed to format string: %s", format.data()); return ""; } void c_DebuggerClientCmdUser::t_print(int _argc, CStrRef format, CArrRef _argv /* = null_array */) { - m_client->print(format_string(m_client, _argc, format, _argv)); + m_client->print(format_string(*m_client, _argc, format, _argv)); } void c_DebuggerClientCmdUser::t_help(int _argc, CStrRef format, CArrRef _argv /* = null_array */) { - m_client->help(format_string(m_client, _argc, format, _argv)); + m_client->help(format_string(*m_client, _argc, format, _argv)); } void c_DebuggerClientCmdUser::t_info(int _argc, CStrRef format, CArrRef _argv /* = null_array */) { - m_client->info(format_string(m_client, _argc, format, _argv)); + m_client->info(format_string(*m_client, _argc, format, _argv)); } void c_DebuggerClientCmdUser::t_output(int _argc, CStrRef format, CArrRef _argv /* = null_array */) { - m_client->output(format_string(m_client, _argc, format, _argv)); + m_client->output(format_string(*m_client, _argc, format, _argv)); } void c_DebuggerClientCmdUser::t_error(int _argc, CStrRef format, CArrRef _argv /* = null_array */) { - m_client->error(format_string(m_client, _argc, format, _argv)); + m_client->error(format_string(*m_client, _argc, format, _argv)); } void c_DebuggerClientCmdUser::t_code(CStrRef source, int highlight_line /* = 0 */, @@ -234,7 +234,7 @@ void c_DebuggerClientCmdUser::t_code(CStrRef source, int highlight_line /* = 0 * Variant c_DebuggerClientCmdUser::t_ask(int _argc, CStrRef format, CArrRef _argv /* = null_array */) { - String ret = format_string(m_client, _argc, format, _argv); + String ret = format_string(*m_client, _argc, format, _argv); return String::FromChar(m_client->ask("%s", ret.data())); } @@ -550,11 +550,11 @@ Variant c_DebuggerClient::t_processcmd(CVarRef cmdName, CVarRef args) { raise_warning("not getting a command"); } else if (cmd->is(DebuggerCommand::KindOfInterrupt)) { CmdInterruptPtr cmdInterrupt = dynamic_pointer_cast(cmd); - cmdInterrupt->onClient(m_client); + cmdInterrupt->onClient(*m_client); } else { // Previous pending commands - cmd->handleReply(m_client); - cmd->setClientOutput(m_client); + cmd->handleReply(*m_client); + cmd->setClientOutput(*m_client); } Logger::Info("debugger client ready for command"); } catch (DebuggerClientExitException &e) {