Debugger: Fix hitting unexisting breakpoints

Set UseFullPath only for BP from the opened projects.

Fixes: QTCREATORBUG-3750
Change-Id: I343c68ca341f9bfb57e352b9b28df333eb1c16c3
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Artem Sokolovskii
2024-06-07 15:20:01 +02:00
parent 65f7665722
commit 2971138cb7

View File

@@ -30,7 +30,9 @@
#include <coreplugin/messagebox.h> #include <coreplugin/messagebox.h>
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectmanager.h>
#include <projectexplorer/taskhub.h> #include <projectexplorer/taskhub.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
@@ -2074,8 +2076,10 @@ QString GdbEngine::breakpointLocation(const BreakpointParameters &data)
return addressSpec(data.address); return addressSpec(data.address);
BreakpointPathUsage usage = data.pathUsage; BreakpointPathUsage usage = data.pathUsage;
if (usage == BreakpointPathUsageEngineDefault) if (usage == BreakpointPathUsageEngineDefault) {
usage = BreakpointUseShortPath; ProjectExplorer::Project *project = ProjectManager::projectForFile(data.fileName);
usage = project ? BreakpointUseFullPath : BreakpointUseShortPath;
}
const QString fileName = usage == BreakpointUseFullPath const QString fileName = usage == BreakpointUseFullPath
? data.fileName.path() : breakLocation(data.fileName); ? data.fileName.path() : breakLocation(data.fileName);
@@ -2088,8 +2092,10 @@ QString GdbEngine::breakpointLocation(const BreakpointParameters &data)
QString GdbEngine::breakpointLocation2(const BreakpointParameters &data) QString GdbEngine::breakpointLocation2(const BreakpointParameters &data)
{ {
BreakpointPathUsage usage = data.pathUsage; BreakpointPathUsage usage = data.pathUsage;
if (usage == BreakpointPathUsageEngineDefault) if (usage == BreakpointPathUsageEngineDefault) {
usage = BreakpointUseShortPath; ProjectExplorer::Project *project = ProjectManager::projectForFile(data.fileName);
usage = project ? BreakpointUseFullPath : BreakpointUseShortPath;
}
const QString fileName = usage == BreakpointUseFullPath const QString fileName = usage == BreakpointUseFullPath
? data.fileName.path() : breakLocation(data.fileName); ? data.fileName.path() : breakLocation(data.fileName);