From 64cd9746b825c757be87b2613ac9853d5710b2ad Mon Sep 17 00:00:00 2001 From: DH Date: Sun, 6 Oct 2013 18:05:58 +0300 Subject: [PATCH] Fixed minor Debugger errors. --- rpcs3/Emu/Cell/PPCThread.cpp | 22 ++++++++++++++--- rpcs3/Emu/Cell/PPCThread.h | 2 ++ rpcs3/Gui/InstructionEditor.cpp | 4 +-- rpcs3/Gui/InterpreterDisAsm.cpp | 44 ++++++--------------------------- rpcs3/Gui/InterpreterDisAsm.h | 6 +---- 5 files changed, 32 insertions(+), 46 deletions(-) diff --git a/rpcs3/Emu/Cell/PPCThread.cpp b/rpcs3/Emu/Cell/PPCThread.cpp index 938389ab5b..c57285ae25 100644 --- a/rpcs3/Emu/Cell/PPCThread.cpp +++ b/rpcs3/Emu/Cell/PPCThread.cpp @@ -8,7 +8,7 @@ PPCThread* GetCurrentPPCThread() } PPCThread::PPCThread(PPCThreadType type) - : ThreadBase(true, "PPCThread") + : ThreadBase(false, "PPCThread") , m_type(type) , DisAsmFrame(nullptr) , m_dec(nullptr) @@ -124,6 +124,11 @@ bool PPCThread::Sync() int PPCThread::ThreadStatus() { + if(m_is_step) + { + return PPCThread_Step; + } + if(Emu.IsStopped()) { return PPCThread_Stopped; @@ -277,6 +282,7 @@ void PPCThread::Stop() void PPCThread::Exec() { + m_is_step = false; wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this); ThreadBase::Start(); //std::thread thr(std::bind(std::mem_fn(&PPCThread::Task), this)); @@ -284,8 +290,12 @@ void PPCThread::Exec() void PPCThread::ExecOnce() { - DoCode(Memory.Read32(m_offset + PC)); - NextPc(); + m_is_step = true; + wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this); + ThreadBase::Start(); + if(!ThreadBase::Wait()) while(m_is_step) Sleep(1); + wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, this); + wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, this); } void PPCThread::Task() @@ -323,6 +333,12 @@ void PPCThread::Task() DoCode(Memory.Read32(m_offset + PC)); NextPc(); + if(status == PPCThread_Step) + { + m_is_step = false; + break; + } + for(uint i=0; iGetValue().ToULong(&opcode, 16)) { + disasm->dump_pc = pc; decoder->Decode((u32)opcode); wxString preview = disasm->last_opcode; - while (preview[0] != ':') preview.Remove(0,1); - preview.Remove(0,1); + preview.Remove(0, preview.Find(':') + 1); t3_preview->SetLabel(preview); } else diff --git a/rpcs3/Gui/InterpreterDisAsm.cpp b/rpcs3/Gui/InterpreterDisAsm.cpp index cf12e9e6c6..ed139a17ee 100644 --- a/rpcs3/Gui/InterpreterDisAsm.cpp +++ b/rpcs3/Gui/InterpreterDisAsm.cpp @@ -13,7 +13,6 @@ u64 InterpreterDisAsmFrame::CentrePc(const u64 pc) const InterpreterDisAsmFrame::InterpreterDisAsmFrame(wxWindow* parent) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(500, 700), wxTAB_TRAVERSAL) - , ThreadBase(false, "DisAsmFrame Thread") , PC(0) , CPU(nullptr) , m_item_count(30) @@ -84,7 +83,6 @@ InterpreterDisAsmFrame::InterpreterDisAsmFrame(wxWindow* parent) InterpreterDisAsmFrame::~InterpreterDisAsmFrame() { - ThreadBase::Stop(); } void InterpreterDisAsmFrame::UpdateUnitList() @@ -443,13 +441,17 @@ void InterpreterDisAsmFrame::DoPause(wxCommandEvent& WXUNUSED(event)) void InterpreterDisAsmFrame::DoStep(wxCommandEvent& WXUNUSED(event)) { - ThreadBase::Start(); + if(CPU) CPU->ExecOnce(); } void InterpreterDisAsmFrame::InstrKey(wxListEvent& event) { long i = m_list->GetFirstSelected(); - if(i < 0 || !CPU) return; + if(i < 0 || !CPU) + { + event.Skip(); + return; + } const u64 start_pc = PC - m_item_count*4; const u64 pc = start_pc + i*4; @@ -465,6 +467,8 @@ void InterpreterDisAsmFrame::InstrKey(wxListEvent& event) DoUpdate(); return; } + + event.Skip(); } void InterpreterDisAsmFrame::DClick(wxListEvent& event) @@ -530,35 +534,3 @@ bool InterpreterDisAsmFrame::RemoveBreakPoint(u64 pc) return false; } - -void InterpreterDisAsmFrame::Task() -{ - if(!CPU) return; - wxGetApp().SendDbgCommand(DID_RESUME_THREAD, CPU); - wxGetApp().SendDbgCommand(DID_RESUMED_THREAD, CPU); - bool dump_status = dump_enable; - - //CPU.InitTls(); - - try - { - do - { - CPU->ExecOnce(); - } - while(CPU->IsRunning() && Emu.IsRunning() && !TestDestroy() && !IsBreakPoint(CPU->PC) && dump_status == dump_enable); - } - catch(const wxString& e) - { - ConLog.Error(e); - } - catch(...) - { - ConLog.Error("Unhandled exception."); - } - - //CPU.FreeTls(); - - wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, CPU); - wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, CPU); -} \ No newline at end of file diff --git a/rpcs3/Gui/InterpreterDisAsm.h b/rpcs3/Gui/InterpreterDisAsm.h index f14068db35..0ef18bcd83 100644 --- a/rpcs3/Gui/InterpreterDisAsm.h +++ b/rpcs3/Gui/InterpreterDisAsm.h @@ -5,9 +5,7 @@ #include "Emu/Cell/SPUDecoder.h" #include "Emu/Cell/SPUDisAsm.h" -class InterpreterDisAsmFrame - : public wxPanel - , public ThreadBase +class InterpreterDisAsmFrame : public wxPanel { wxListView* m_list; PPC_DisAsm* disasm; @@ -53,6 +51,4 @@ public: bool IsBreakPoint(u64 pc); void AddBreakPoint(u64 pc); bool RemoveBreakPoint(u64 pc); - - virtual void Task(); }; \ No newline at end of file