Reduce redundant spew when breaking on an unhandled exception. Quit cleanly.
Currently the debugger prints the line where an exception has been thrown, along with the type exception. Then it prints the source listing of the exception. Then it prints a serialization of the exception, which includes a full stack trace. Since the debugger has a command for printing stack traces, the latter bit information seems completely redundant when stopped in the command line client. This diff suppresses the stack trace in that case. It also suppresses redundant diagnostics that get generated during the debugger's attempt to find and print the source code in response to a list command. Finally, the quit command was too eager to let the client die after notifying the proxy, causing the proxy to get a pipe closed exception rather than the quit command, which often allowed the program to carry on running after the client has already quit. The quit command now waits for an acknowledgement from the proxy before shutting down.
Esse commit está contido em:
@@ -209,7 +209,9 @@ void CmdInterrupt::onClientImpl(DebuggerClient &client) {
|
||||
m_bpi->m_exceptionClass.c_str(),
|
||||
m_bpi->site().c_str());
|
||||
client.shortCode(m_bpi);
|
||||
client.output(m_bpi->m_exceptionObject);
|
||||
if (client.isApiMode() || client.getLogFileHandler()) {
|
||||
client.output(m_bpi->m_exceptionObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!bpm->m_output.empty()) {
|
||||
|
||||
@@ -335,8 +335,10 @@ void CmdList::onClientImpl(DebuggerClient &client) {
|
||||
// The function returns false if the reply to the client fails during the
|
||||
// sending process.
|
||||
bool CmdList::onServer(DebuggerProxy &proxy) {
|
||||
auto savedWarningFrequency = RuntimeOption::WarningFrequency;
|
||||
RuntimeOption::WarningFrequency = 0;
|
||||
m_code = f_file_get_contents(m_file.c_str());
|
||||
if (!m_code && m_file[0] != '/') {
|
||||
if (!proxy.isLocal() && !m_code && m_file[0] != '/') {
|
||||
DSandboxInfo info = proxy.getSandbox();
|
||||
if (info.m_path.empty()) {
|
||||
raise_warning("path for sandbox %s is not setup, run a web request",
|
||||
@@ -346,11 +348,12 @@ bool CmdList::onServer(DebuggerProxy &proxy) {
|
||||
m_code = f_file_get_contents(full_path.c_str());
|
||||
}
|
||||
}
|
||||
RuntimeOption::WarningFrequency = savedWarningFrequency;
|
||||
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
|
||||
// Returns false if the file does not exist or could not be read as an
|
||||
// HPHP::String instance containing the contents of the file.
|
||||
Variant CmdList::GetSourceFile(DebuggerClient &client,
|
||||
const std::string &file) {
|
||||
|
||||
@@ -41,12 +41,23 @@ void CmdQuit::onClientImpl(DebuggerClient &client) {
|
||||
if (DebuggerCommand::displayedHelp(client)) return;
|
||||
|
||||
if (client.argCount() == 0) {
|
||||
client.sendToServer(this);
|
||||
client.xend<CmdQuit>(this); // Wait for server ack before closing pipe.
|
||||
client.quit();
|
||||
} else {
|
||||
help(client);
|
||||
}
|
||||
}
|
||||
|
||||
// Sends an acknowledgment back to the client so that
|
||||
// it can go ahead and terminate. It it were to do so
|
||||
// before the server has received the command, the pipe
|
||||
// will be closed and the proxy will carry on as if there
|
||||
// were a communication failure, which is not as clean
|
||||
// explicitly quitting.
|
||||
bool CmdQuit::onServer(DebuggerProxy &proxy) {
|
||||
TRACE(2, "CmdQuit::onServer\n");
|
||||
return proxy.sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
}}
|
||||
|
||||
@@ -27,14 +27,11 @@ class CmdQuit : public DebuggerCommand {
|
||||
public:
|
||||
CmdQuit() : DebuggerCommand(KindOfQuit) {}
|
||||
|
||||
// The text to display when the debugger client processes "help quit".
|
||||
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 bool onServer(DebuggerProxy &proxy);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -625,6 +625,7 @@ void DebuggerProxy::processInterrupt(CmdInterrupt &cmd) {
|
||||
}
|
||||
if (res->is(DebuggerCommand::KindOfQuit)) {
|
||||
TRACE_RB(2, "Received quit command\n");
|
||||
res->onServer(*this); // acknowledge receipt so that client can quit.
|
||||
Debugger::RemoveProxy(shared_from_this());
|
||||
forceQuit();
|
||||
throw DebuggerClientExitException();
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário