Add basic debugging information to crash reports

I'm adding the count of connected debuggers, and whether or not the process is hphpd, to the crash reports. In another diff I'll wire these up to hphpcrash_categorizer.py and get these as columns in the Hphpcrash Scuba data set so we can filter crash reports based on whether or not it's from hphpd, and whether or not a server was being debugged when it crashed.
Esse commit está contido em:
Mike Magruder
2013-05-17 10:15:03 -07:00
commit de Sara Golemon
commit fb093f8850
5 arquivos alterados com 11 adições e 6 exclusões
+4 -1
Ver Arquivo
@@ -52,7 +52,10 @@ static void bt_handler(int sig) {
sprintf(tracefn, "%s/stacktrace.%s.log",
RuntimeOption::CoreDumpReportDirectory.c_str(), pid);
st.log(strsignal(sig), tracefn, pid, kCompilerId);
int debuggerCount = RuntimeOption::EnableDebugger ?
Eval::Debugger::CountConnectedProxy() : 0;
st.log(strsignal(sig), tracefn, pid, kCompilerId, debuggerCount);
int fd = ::open(tracefn, O_APPEND|O_WRONLY, S_IRUSR|S_IWUSR);
if (fd >= 0) {
+1
Ver Arquivo
@@ -1028,6 +1028,7 @@ static int execute_program_impl(int argc, char **argv) {
hphp_process_init();
if (po.mode == "debug") {
StackTraceNoHeap::AddExtraLogging("IsDebugger", "True");
RuntimeOption::EnableDebugger = true;
Eval::DebuggerProxyPtr proxy =
Eval::Debugger::StartClient(po.debugger_options);
@@ -658,6 +658,7 @@ void DebuggerClient::stop() {
void DebuggerClient::run() {
TRACE(2, "DebuggerClient::run\n");
StackTraceNoHeap::AddExtraLogging("IsDebugger", "True");
// Make sure we don't run the interface thread for API mode
assert(!isApiMode());
+3 -1
Ver Arquivo
@@ -227,7 +227,8 @@ void StackTraceNoHeap::ClearAllExtraLogging() {
}
void StackTraceNoHeap::log(const char *errorType, const char *tracefn,
const char *pid, const char *buildId) const {
const char *pid, const char *buildId,
int debuggerCount) const {
int fd = ::open(tracefn, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR);
if (fd < 0) return;
@@ -239,6 +240,7 @@ void StackTraceNoHeap::log(const char *errorType, const char *tracefn,
dprintf(fd, "Type: %s\n", errorType ? errorType : "(unknown error)");
dprintf(fd, "Runtime: hhvm\n");
dprintf(fd, "Version: %s\n", buildId);
dprintf(fd, "DebuggerCount: %d\n", debuggerCount);
dprintf(fd, "\n");
for (auto const& pair : StackTraceLog::s_logData->data) {
+2 -4
Ver Arquivo
@@ -140,12 +140,10 @@ public:
explicit StackTraceNoHeap(bool trace = true);
/**
* Log stacktrace into a file under /tmp. If "out" is not null,
* also store translated stack trace into the variable.
* Returns the name of the generated file.
* Log stacktrace into the given file.
*/
void log(const char *errorType, const char * fname, const char *pid,
const char *buildId) const;
const char *buildId, int debuggerCount) const;
/**
* Add extra information to log together with a crash stacktrace log.