Skip to content

Commit

Permalink
fix: [python] issues of debug python program
Browse files Browse the repository at this point in the history
1.close project can`t quit debugging state
2.Pausing the Python debugging process may cause some exceptions

Log: as title
  • Loading branch information
LiHua000 authored and deepin-mozart committed Nov 1, 2024
1 parent 8e61351 commit fc9ce27
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/plugins/debugger/dap/dapdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ void DAPDebugger::registerDapHandlers()
|| event.reason == "function-finished"
|| event.reason == "end-stepping-range"
|| event.reason == "goto"
|| event.reason == "pause" // python send it when pauseing
|| signalStopped
|| (event.reason == "unknown" && attaching)) {
//when attaching to running program . it won`t receive initialized event and event`s reason is "unknwon"
Expand All @@ -650,7 +651,6 @@ void DAPDebugger::registerDapHandlers()
updateThreadList(curThreadID, threads);
switchCurrentThread(static_cast<int>(d->threadId));
}
QApplication::setActiveWindow(d->variablesPane);
updateRunState(DAPDebugger::RunState::kStopped);
} else if (event.reason == "exception") {
QString name;
Expand Down Expand Up @@ -854,8 +854,8 @@ void DAPDebugger::handleEvents(const dpf::Event &event)
} else if (event.data() == project.deletedProject.name) {
auto prjInfo = event.property("projectInfo").value<dpfservice::ProjectInfo>();
if (d->projectInfo.isSame(prjInfo)) {
d->activeProjectKitName.clear();
abortDebug();
d->activeProjectKitName.clear();
}
} else if (event.data() == editor.switchedFile.name) {
QString filePath = event.property(editor.switchedFile.pKeys[0]).toString();
Expand Down Expand Up @@ -1293,13 +1293,15 @@ void DAPDebugger::exitDebug()
{
// Change UI.
editor.removeDebugLine();
d->variablesPane->hide();
d->watchsModel.clear();
d->localsModel.clear();

d->localsModel.clear();
d->stackModel.removeAll();

d->threadId = 0;

d->threads.clear();
d->threadSelector->clear();
}

Expand All @@ -1316,7 +1318,6 @@ void DAPDebugger::updateRunState(DAPDebugger::RunState state)
case kRunning:
case kCustomRunning:
d->pausing = false;
QMetaObject::invokeMethod(d->variablesPane, "show");
break;
case kStopped:
break;
Expand Down Expand Up @@ -1345,9 +1346,6 @@ QString DAPDebugger::requestBuild()

void DAPDebugger::start()
{
if(!d->variablesPane->isVisible())
d->variablesPane->show();

auto &ctx = dpfInstance.serviceContext();
LanguageService *service = ctx.service<LanguageService>(LanguageService::name());
if (service) {
Expand Down

0 comments on commit fc9ce27

Please sign in to comment.