void Manager::gotoLocations(const QList<QVariant> &list) { QSet<SymbolLocation> locations = Utils::roleToLocations(list); if (locations.count() == 0) return; QString fileName; int line = 0; int column = 0; bool currentPositionAvailable = false; // what is open now? Core::IEditor *editor = Core::EditorManager::instance()->currentEditor(); if (editor) { // get current file name Core::IDocument *document = editor->document(); if (document) fileName = document->fileName(); // if text file - what is current position? TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor); if (textEditor) { // there is open currently text editor int position = textEditor->position(); textEditor->convertPosition(position, &line, &column); currentPositionAvailable = true; } } // if there is something open - try to check, is it currently activated symbol? if (currentPositionAvailable) { SymbolLocation current(fileName, line, column); QSet<SymbolLocation>::const_iterator it = locations.find(current); QSet<SymbolLocation>::const_iterator end = locations.constEnd(); // is it known location? if (it != end) { // found - do one additional step ++it; if (it == end) it = locations.begin(); const SymbolLocation &found = *it; gotoLocation(found.fileName(), found.line(), found.column()); return; } } // no success - open first item in the list const SymbolLocation loc = *locations.constBegin(); gotoLocation(loc.fileName(), loc.line(), loc.column()); }
void PdbEngine::activateFrame(int frameIndex) { resetLocation(); if (state() != InferiorStopOk && state() != InferiorUnrunnable) return; StackHandler *handler = stackHandler(); int oldIndex = handler->currentIndex(); //if (frameIndex == handler->stackSize()) { // reloadFullStack(); // return; //} QTC_ASSERT(frameIndex < handler->stackSize(), return); if (oldIndex != frameIndex) { // Assuming the command always succeeds this saves a roundtrip. // Otherwise the lines below would need to get triggered // after a response to this -stack-select-frame here. handler->setCurrentIndex(frameIndex); //postCommand("-stack-select-frame " + QByteArray::number(frameIndex), // CB(handleStackSelectFrame)); } gotoLocation(handler->currentFrame()); }
void IPCEngineHost::rpcCallback(quint64 f, QByteArray payload) { switch (f) { default: { showMessage(QLatin1String("IPC Error: unhandled id in guest to host call")); const QString logMessage = tr("Fatal engine shutdown. Incompatible binary or IPC error."); showMessage(logMessage, LogError); showStatusMessage(logMessage); } nuke(); break; case IPCEngineGuest::NotifyEngineSetupOk: notifyEngineSetupOk(); break; case IPCEngineGuest::NotifyEngineSetupFailed: notifyEngineSetupFailed(); break; case IPCEngineGuest::NotifyEngineRunFailed: notifyEngineRunFailed(); break; case IPCEngineGuest::NotifyInferiorSetupOk: attemptBreakpointSynchronization(); notifyInferiorSetupOk(); break; case IPCEngineGuest::NotifyInferiorSetupFailed: notifyInferiorSetupFailed(); break; case IPCEngineGuest::NotifyEngineRunAndInferiorRunOk: notifyEngineRunAndInferiorRunOk(); break; case IPCEngineGuest::NotifyEngineRunAndInferiorStopOk: notifyEngineRunAndInferiorStopOk(); break; case IPCEngineGuest::NotifyInferiorRunRequested: notifyInferiorRunRequested(); break; case IPCEngineGuest::NotifyInferiorRunOk: notifyInferiorRunOk(); break; case IPCEngineGuest::NotifyInferiorRunFailed: notifyInferiorRunFailed(); break; case IPCEngineGuest::NotifyInferiorStopOk: notifyInferiorStopOk(); break; case IPCEngineGuest::NotifyInferiorSpontaneousStop: notifyInferiorSpontaneousStop(); break; case IPCEngineGuest::NotifyInferiorStopFailed: notifyInferiorStopFailed(); break; case IPCEngineGuest::NotifyInferiorExited: notifyInferiorExited(); break; case IPCEngineGuest::NotifyInferiorShutdownOk: notifyInferiorShutdownOk(); break; case IPCEngineGuest::NotifyInferiorShutdownFailed: notifyInferiorShutdownFailed(); break; case IPCEngineGuest::NotifyEngineSpontaneousShutdown: notifyEngineSpontaneousShutdown(); break; case IPCEngineGuest::NotifyEngineShutdownOk: notifyEngineShutdownOk(); break; case IPCEngineGuest::NotifyEngineShutdownFailed: notifyEngineShutdownFailed(); break; case IPCEngineGuest::NotifyInferiorIll: notifyInferiorIll(); break; case IPCEngineGuest::NotifyEngineIll: notifyEngineIll(); break; case IPCEngineGuest::NotifyInferiorPid: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 pid; s >> pid; notifyInferiorPid(pid); } break; case IPCEngineGuest::ShowStatusMessage: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); QString msg; qint64 timeout; s >> msg; s >> timeout; showStatusMessage(msg, timeout); } break; case IPCEngineGuest::ShowMessage: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); QString msg; qint16 channel; qint64 timeout; s >> msg; s >> channel; s >> timeout; showMessage(msg, channel, timeout); } break; case IPCEngineGuest::CurrentFrameChanged: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 token; s >> token; resetLocation(); StackHandler *sh = stackHandler(); sh->setCurrentIndex(token); if (!sh->currentFrame().isUsable() || QFileInfo(sh->currentFrame().file).exists()) gotoLocation(Location(sh->currentFrame(), true)); else if (!m_sourceAgents.contains(sh->currentFrame().file)) fetchFrameSource(token); foreach(SourceAgent *agent, m_sourceAgents.values()) agent->updateLocationMarker(); } break; case IPCEngineGuest::CurrentThreadChanged: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 token; s >> token; threadsHandler()->setCurrentThreadId(token); } break; case IPCEngineGuest::ListFrames: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); StackFrames frames; s >> frames; stackHandler()->setFrames(frames); } break; case IPCEngineGuest::ListThreads: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); Threads threads; s >> threads; threadsHandler()->setThreads(threads); } break; case IPCEngineGuest::Disassembled: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); quint64 pc; DisassemblerLines lines; s >> pc; s >> lines; DisassemblerAgent *view = m_frameToDisassemblerAgent.take(pc); if (view) view->setContents(lines); } break; case IPCEngineGuest::UpdateWatchData: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); bool fullCycle; qint64 count; QList<WatchData> wd; s >> fullCycle; s >> count; for (qint64 i = 0; i < count; ++i) { WatchData d; s >> d; wd.append(d); } WatchHandler *wh = watchHandler(); if (!wh) break; wh->beginCycle(fullCycle); wh->insertBulkData(wd); wh->endCycle(fullCycle); } break; case IPCEngineGuest::NotifyAddBreakpointOk: { attemptBreakpointSynchronization(); QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointInsertOk(id); } break; case IPCEngineGuest::NotifyAddBreakpointFailed: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointInsertFailed(id); } break; case IPCEngineGuest::NotifyRemoveBreakpointOk: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointRemoveOk(id); } break; case IPCEngineGuest::NotifyRemoveBreakpointFailed: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointRemoveFailed(id); } break; case IPCEngineGuest::NotifyChangeBreakpointOk: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointChangeOk(id); } break; case IPCEngineGuest::NotifyChangeBreakpointFailed: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; s >> id; breakHandler()->notifyBreakpointChangeFailed(id); } break; case IPCEngineGuest::NotifyBreakpointAdjusted: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); BreakpointId id; BreakpointParameters d; s >> id >> d; breakHandler()->notifyBreakpointAdjusted(id, d); } break; case IPCEngineGuest::FrameSourceFetched: { QDataStream s(payload); SET_NATIVE_BYTE_ORDER(s); qint64 token; QString path; QString source; s >> token >> path >> source; SourceAgent *agent = new SourceAgent(this); agent->setSourceProducerName(startParameters().connParams.host); agent->setContent(path, source); m_sourceAgents.insert(path, agent); agent->updateLocationMarker(); } break; } }