Skip to content

Commit

Permalink
fix: [debug] abnormal debugging status when switching projects during…
Browse files Browse the repository at this point in the history
… debugging.

Log: as title

bug: https://pms.uniontech.com/bug-view-284749.html
  • Loading branch information
LiHua000 authored and deepin-mozart committed Nov 8, 2024
1 parent 96411b0 commit 064c690
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/plugins/debugger/dap/dapdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class DebuggerPrivate
QString currentBuildUuid;
QString requestDAPPortPpid;
QString userKitName;
QString currentDebugKit;

QSharedPointer<RunTimeCfgProvider> rtCfgProvider;
DEBUG::DebugSession *localSession { nullptr };
Expand Down Expand Up @@ -347,8 +348,7 @@ void DAPDebugger::abortDebug()
auto &ctx = dpfInstance.serviceContext();
LanguageService *service = ctx.service<LanguageService>(LanguageService::name());
if (service) {
QString kitName = (d->runState == kCustomRunning) ? d->userKitName : d->activeProjectKitName;
auto generator = service->create<LanguageGenerator>(kitName);
auto generator = service->create<LanguageGenerator>(d->currentDebugKit);
if (generator) {
if (generator->isStopDAPManually()) {
stopDAP();
Expand All @@ -367,6 +367,10 @@ void DAPDebugger::restartDebug()
auto &ctx = dpfInstance.serviceContext();
LanguageService *service = ctx.service<LanguageService>(LanguageService::name());
if (service) {
if (d->activeProjectKitName != d->currentDebugKit) {
abortDebug();
return;
}
auto generator = service->create<LanguageGenerator>(d->activeProjectKitName);
if (generator) {
if (generator->isRestartDAPManually()) {
Expand Down Expand Up @@ -1295,6 +1299,7 @@ void DAPDebugger::exitDebug()
editor.removeDebugLine();
d->watchsModel.clear();
d->localsModel.clear();
d->currentDebugKit.clear();

d->localsModel.clear();
d->stackModel.removeAll();
Expand Down Expand Up @@ -1476,6 +1481,7 @@ void DAPDebugger::launchSession(int port, const QMap<QString, QVariant> &param,
.arg(port);
printOutput(launchTip);

d->currentDebugKit = kitName;
auto iniRequet = d->rtCfgProvider->initalizeRequest();
bool bSuccess = false;
if (!d->isRemote)
Expand Down

0 comments on commit 064c690

Please sign in to comment.