Fixed minor Debugger errors.

This commit is contained in:
DH 2013-10-06 18:05:58 +03:00
parent 8259006bc3
commit 64cd9746b8
5 changed files with 32 additions and 46 deletions

View File

@ -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; i<bp.GetCount(); ++i)
{
if(bp[i] == m_offset + PC)

View File

@ -17,6 +17,7 @@ enum PPCThreadStatus
PPCThread_Stopped,
PPCThread_Sleeping,
PPCThread_Break,
PPCThread_Step,
};
class PPCThread : public ThreadBase
@ -36,6 +37,7 @@ protected:
u64 m_offset;
u32 m_exit_status;
bool m_free_data;
bool m_is_step;
public:
u64 stack_size;

View File

@ -90,10 +90,10 @@ void InstructionEditorDialog::updatePreview(wxCommandEvent& event)
unsigned long opcode;
if (t2_instr->GetValue().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

View File

@ -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);
}

View File

@ -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();
};