void AdminServer::process(IProtocol & protocol) { uint32_t id = protocol.readUInt32(); switch (id) { case AdminID_Exit: processExit(protocol); break; case AdminID_LoadHandler: processLoadHandler(protocol); break; default: throw std::runtime_error("AdminServer::process: unknown ID"); } }
/** * Processes a stop-reply message. * * @param msg The message to process. * * @return A NaviError code that describes whether the operation was successful * or not. */ NaviError GdbSystem::processMessage(const std::string& msg) { if (cpu->isBreakpointMessage(msg)) { bool isRegular = cpu->hasRegularBreakpointMessage(); unsigned int signal = isRegular ? zylib::zycon::parseHexString<unsigned int>(msg.substr(2, 2)) : 0; msglog->log(LOG_VERBOSE, "Received stop message %s", msg.c_str()); if (!isRegular || signal == 5) { return processBreakpointMessage(msg); } else if (signal == SIGSEGV) { // SEGFAULT msglog->log(LOG_ALWAYS, "Target process segfaulted"); cpu->sendAck(); CPUADDRESS address = 0; NaviError eipResult = getInstructionPointer( threadFromBreakpointMessage(msg), address); if (eipResult) { msglog->log(LOG_VERBOSE, "Error: Couldn't read the value of the " "instruction pointer (Code %d)", eipResult); return eipResult; } exceptionRaised(threadFromBreakpointMessage(msg), address, signal); return NaviErrors::SUCCESS; } else { msglog->log(LOG_ALWAYS, "Received unknown stop message %s", msg.c_str()); cpu->sendAck(); resume(threadFromBreakpointMessage(msg)); return NaviErrors::SUCCESS; } } else if (cpu->isProcessExitMessage(msg) || cpu->isProcessTerminateMessage(msg)) { cpu->sendAck(); // Tell the base system that the process exited processExit(); } else { msglog->log(LOG_ALWAYS, "Error: Received unknown message %s", msg.c_str()); } return NaviErrors::SUCCESS; }
void LSThread::relayExit(int code, QProcess::ExitStatus stat) { Q_UNUSED(stat); emit processExit(code); }