Fix debugger crash after using shutdown. Fixes #1074

This commit is contained in:
Kingcom 2015-12-29 22:53:10 +01:00 committed by Gregory Hainaut
parent 5a591dd650
commit a6ef814653
3 changed files with 24 additions and 3 deletions

View File

@ -134,6 +134,7 @@ void SysCoreThread::Reset()
GetVmMemory().DecommitAll();
SysClearExecutionCache();
sApp.PostAppMethod( &Pcsx2App::leaveDebugMode );
g_FrameCount = 0;
}

View File

@ -177,7 +177,7 @@ void CpuTabPage::update()
{
breakpointList->reloadBreakpoints();
if (threadList != NULL)
if (threadList != NULL && cpu->isAlive())
{
threadList->reloadThreads();
@ -255,7 +255,7 @@ DisassemblyDialog::DisassemblyDialog(wxWindow* parent):
topSizer->Add(topRowSizer,0,wxLEFT|wxRIGHT|wxTOP,3);
// create middle part of the window
wxNotebook* middleBook = new wxNotebook(panel,wxID_ANY);
middleBook = new wxNotebook(panel,wxID_ANY);
middleBook->SetBackgroundColour(wxColour(0xFFF0F0F0));
eeTab = new CpuTabPage(middleBook,&r5900Debug);
iopTab = new CpuTabPage(middleBook,&r3000Debug);
@ -486,7 +486,7 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
if (type == debEVT_SETSTATUSBARTEXT)
{
DebugInterface* cpu = reinterpret_cast<DebugInterface*>(evt.GetClientData());
if (cpu != NULL && cpu == currentCpu->getCpu())
if (cpu != NULL && currentCpu != NULL && cpu == currentCpu->getCpu())
GetStatusBar()->SetLabel(evt.GetString());
} else if (type == debEVT_UPDATELAYOUT)
{
@ -585,6 +585,19 @@ void DisassemblyDialog::setDebugMode(bool debugMode, bool switchPC)
if (running)
{
if (currentCpu == NULL)
{
wxWindow* currentPage = middleBook->GetCurrentPage();
if (currentPage == eeTab)
currentCpu = eeTab;
else if (currentPage == iopTab)
currentCpu = iopTab;
if (currentCpu != NULL)
currentCpu->update();
}
if (debugMode)
{
CBreakPoints::ClearTemporaryBreakPoints();
@ -613,6 +626,12 @@ void DisassemblyDialog::setDebugMode(bool debugMode, bool switchPC)
stepOverButton->Enable(false);
stepOutButton->Enable(false);
}
} else {
breakRunButton->SetLabel(L"Run");
stepIntoButton->Enable(false);
stepOverButton->Enable(false);
stepOutButton->Enable(false);
currentCpu = NULL;
}
update();

View File

@ -112,6 +112,7 @@ private:
CpuTabPage* eeTab;
CpuTabPage* iopTab;
CpuTabPage* currentCpu;
wxNotebook* middleBook;
wxBoxSizer* topSizer;
wxButton* breakRunButton;