diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index c561e367c1f..53f3dac48e0 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -916,7 +916,7 @@ void CdbEngine::handleJumpToLineAddressResolution(const DebuggerResponse &respon const quint64 address = answer.toULongLong(&ok, 16); if (ok && address) { jumpToAddress(address); - gotoLocation(Location(context.fileName.toString(), context.lineNumber)); + gotoLocation(Location(context.fileName, context.lineNumber)); } } diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index e0f00b883f1..24a0a364279 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -163,7 +163,7 @@ static bool debuggerActionsEnabledHelper(DebuggerState state) Location::Location(const StackFrame &frame, bool marker) { - m_fileName = frame.file; + m_fileName = Utils::FilePath::fromString(frame.file); m_lineNumber = frame.line; m_needsMarker = marker; m_functionName = frame.function; @@ -1081,7 +1081,7 @@ void DebuggerEngine::gotoLocation(const Location &loc) showMessage("CANNOT GO TO THIS LOCATION"); return; } - const QString file = QDir::cleanPath(loc.fileName()); + const QString file = loc.fileName().toString(); const int line = loc.lineNumber(); bool newEditor = false; IEditor *editor = EditorManager::openEditor( @@ -1096,7 +1096,7 @@ void DebuggerEngine::gotoLocation(const Location &loc) editor->document()->setProperty(Constants::OPENED_BY_DEBUGGER, true); if (loc.needsMarker()) { - d->m_locationMark.reset(new LocationMark(this, FilePath::fromString(file), line)); + d->m_locationMark.reset(new LocationMark(this, loc.fileName(), line)); d->m_locationMark->setToolTip(tr("Current debugger location of %1").arg(displayName())); } } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 25aa4a56aa5..0d8a61695c0 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -225,17 +225,17 @@ class Location public: Location() = default; Location(quint64 address) { m_address = address; } - Location(const QString &file) { m_fileName = file; } - Location(const QString &file, int line, bool marker = true) + Location(const Utils::FilePath &file) { m_fileName = file; } + Location(const Utils::FilePath &file, int line, bool marker = true) { m_lineNumber = line; m_fileName = file; m_needsMarker = marker; } Location(const StackFrame &frame, bool marker = true); - QString fileName() const { return m_fileName; } + Utils::FilePath fileName() const { return m_fileName; } QString functionName() const { return m_functionName; } QString from() const { return m_from; } int lineNumber() const { return m_lineNumber; } void setNeedsRaise(bool on) { m_needsRaise = on; } void setNeedsMarker(bool on) { m_needsMarker = on; } - void setFileName(const QString &fileName) { m_fileName = fileName; } + void setFileName(const Utils::FilePath &fileName) { m_fileName = fileName; } void setUseAssembler(bool on) { m_hasDebugInfo = !on; } bool needsRaise() const { return m_needsRaise; } bool needsMarker() const { return m_needsMarker; } @@ -249,7 +249,7 @@ private: bool m_needsRaise = true; bool m_hasDebugInfo = true; int m_lineNumber = -1; - QString m_fileName; + Utils::FilePath m_fileName; QString m_functionName; QString m_from; quint64 m_address = 0; diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp index d8a083b8d53..3af906f2980 100644 --- a/src/plugins/debugger/disassembleragent.cpp +++ b/src/plugins/debugger/disassembleragent.cpp @@ -106,7 +106,7 @@ bool FrameKey::matches(const Location &loc) const { return loc.address() >= startAddress && loc.address() <= endAddress - && loc.fileName() == fileName + && loc.fileName().toString() == fileName && loc.functionName() == functionName; } @@ -248,7 +248,7 @@ void DisassemblerAgent::setLocation(const Location &loc) QString("Using cached disassembly for 0x%1 (0x%2-0x%3) in \"%4\"/ \"%5\"") .arg(loc.address(), 0, 16) .arg(key.startAddress, 0, 16).arg(key.endAddress, 0, 16) - .arg(loc.functionName(), QDir::toNativeSeparators(loc.fileName())); + .arg(loc.functionName(), loc.fileName().toUserOutput()); d->engine->showMessage(msg); setContentsToDocument(d->cache.at(index).second); d->resetLocationScheduled = false; // In case reset from previous run still pending. @@ -295,7 +295,7 @@ void DisassemblerAgent::setContents(const DisassemblerLines &contents) const quint64 endAddress = contents.endAddress(); if (startAddress) { FrameKey key; - key.fileName = d->location.fileName(); + key.fileName = d->location.fileName().toString(); key.functionName = d->location.functionName(); key.startAddress = startAddress; key.endAddress = endAddress; @@ -325,7 +325,7 @@ void DisassemblerAgent::setContentsToDocument(const DisassemblerLines &contents) // Make that a proper TextDocument reimplementation. d->document->setProperty(Debugger::Constants::OPENED_BY_DEBUGGER, true); d->document->setProperty(Debugger::Constants::OPENED_WITH_DISASSEMBLY, true); - d->document->setProperty(Debugger::Constants::DISASSEMBLER_SOURCE_FILE, d->location.fileName()); + d->document->setProperty(Debugger::Constants::DISASSEMBLER_SOURCE_FILE, d->location.fileName().toString()); d->configureMimeType(); } else { EditorManager::activateEditorForDocument(d->document); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 716cc2aa214..39ed4dc04a2 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1210,25 +1210,28 @@ void GdbEngine::handleStopResponse(const GdbMi &data) showMessage("INVALID STOPPED REASON", LogWarning); } + const FilePath fileName = FilePath::fromString(fullName); + if (!nr.isEmpty() && frame.isValid()) { // Use opportunity to update the breakpoint marker position. if (Breakpoint bp = breakHandler()->findBreakpointByResponseId(nr)) { - FilePath fileName = bp->fileName(); - if (fileName.isEmpty()) - fileName = FilePath::fromString(fullName); - if (!fileName.isEmpty()) + const FilePath &bpFileName = bp->fileName(); + if (!bpFileName.isEmpty()) + bp->setMarkerFileAndLine(bpFileName, lineNumber); + else if (!fileName.isEmpty()) bp->setMarkerFileAndLine(fileName, lineNumber); } } //qDebug() << "BP " << rid << data.toString(); // Quickly set the location marker. - if (lineNumber && !operatesByInstruction() - && QFileInfo::exists(fullName) + if (lineNumber + && !operatesByInstruction() + && fileName.exists() && function != "qt_v4TriggeredBreakpointHook" && function != "qt_qmlDebugMessageAvailable" && language != "js") - gotoLocation(Location(fullName, lineNumber)); + gotoLocation(Location(fileName, lineNumber)); if (state() == InferiorRunOk) { // Stop triggered by a breakpoint or otherwise not directly diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 7ce44621a08..e7873afba32 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -928,20 +928,18 @@ void LldbEngine::handleStateNotification(const GdbMi &item) void LldbEngine::handleLocationNotification(const GdbMi &reportedLocation) { qulonglong address = reportedLocation["address"].toAddress(); - QString fileName = reportedLocation["file"].data(); + Utils::FilePath fileName = FilePath::fromUserInput(reportedLocation["file"].data()); QString function = reportedLocation["function"].data(); int lineNumber = reportedLocation["line"].toInt(); Location loc = Location(fileName, lineNumber); - if (operatesByInstruction() || !QFileInfo::exists(fileName) || lineNumber <= 0) { + if (operatesByInstruction() || !fileName.exists() || lineNumber <= 0) { loc = Location(address); loc.setNeedsMarker(true); loc.setUseAssembler(true); } // Quickly set the location marker. - if (lineNumber > 0 - && QFileInfo::exists(fileName) - && function != "::qt_qmlDebugMessageAvailable()") + if (lineNumber > 0 && fileName.exists() && function != "::qt_qmlDebugMessageAvailable()") gotoLocation(Location(fileName, lineNumber)); } diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index dda92488c39..333f792245e 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -211,7 +211,7 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev) addAction(menu, tr("Edit File \"%1\"").arg(moduleName), tr("Edit File"), moduleNameValid, - [this, modulePath] { engine->gotoLocation(modulePath); }); + [this, modulePath] { engine->gotoLocation(FilePath::fromString(modulePath)); }); addAction(menu, tr("Show Symbols in File \"%1\"").arg(moduleName), tr("Show Symbols"), diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 16dd00134d7..8bde882a44b 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -465,8 +465,8 @@ void QmlEngine::errorMessageBoxFinished(int result) void QmlEngine::gotoLocation(const Location &location) { - const QString fileName = location.fileName(); - if (QUrl(fileName).isLocalFile()) { + if (location.fileName().isLocal()) { + const QString fileName = location.fileName().toString(); // internal file from source files -> show generated .js QTC_ASSERT(d->sourceDocuments.contains(fileName), return); diff --git a/src/plugins/debugger/sourcefileshandler.cpp b/src/plugins/debugger/sourcefileshandler.cpp index 16873197768..bd3ddb4d78e 100644 --- a/src/plugins/debugger/sourcefileshandler.cpp +++ b/src/plugins/debugger/sourcefileshandler.cpp @@ -110,7 +110,7 @@ QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const bool SourceFilesHandler::setData(const QModelIndex &idx, const QVariant &data, int role) { if (role == BaseTreeView::ItemActivatedRole) { - m_engine->gotoLocation(idx.data().toString()); + m_engine->gotoLocation(FilePath::fromString(idx.data().toString())); return true; } @@ -135,7 +135,7 @@ bool SourceFilesHandler::setData(const QModelIndex &idx, const QVariant &data, i addAction(tr("Open File"), false, {}); else addAction(tr("Open File \"%1\"").arg(name), true, - [this, name] { m_engine->gotoLocation(name); }); + [this, name] { m_engine->gotoLocation(FilePath::fromString(name)); }); Internal::addHideColumnActions(menu, ev.view()); menu->addAction(action(SettingsDialog));