mirror of https://github.com/PCSX2/pcsx2.git
-Add lq/sq preview
-fix potential memory access exceptions -prevent the disassembly from changing positions when a breakpoint is toggled -only use the status bar text from the current cpu
This commit is contained in:
parent
69f57351b2
commit
53159a81cf
|
@ -27,6 +27,10 @@
|
||||||
#include "../IopMem.h"
|
#include "../IopMem.h"
|
||||||
#include "SymbolMap.h"
|
#include "SymbolMap.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern AppCoreThread CoreThread;
|
extern AppCoreThread CoreThread;
|
||||||
|
|
||||||
R5900DebugInterface r5900Debug;
|
R5900DebugInterface r5900Debug;
|
||||||
|
@ -204,25 +208,48 @@ bool DebugInterface::parseExpression(PostfixExpression& exp, u64& dest)
|
||||||
// R5900DebugInterface
|
// R5900DebugInterface
|
||||||
//
|
//
|
||||||
|
|
||||||
u32 R5900DebugInterface::read8(u32 address)
|
u32 R5900DebugInterface::readMemory(u32 address, u32 size)
|
||||||
{
|
{
|
||||||
if (!isValidAddress(address))
|
if (!isValidAddress(address))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
// TODO: Add linux variant of the following __try/__except
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
return memRead8(address);
|
return memRead8(address);
|
||||||
|
case 2:
|
||||||
|
return memRead16(address);
|
||||||
|
case 4:
|
||||||
|
return memRead32(address);
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
} __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 R5900DebugInterface::read8(u32 address)
|
||||||
|
{
|
||||||
|
return readMemory(address,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 R5900DebugInterface::read16(u32 address)
|
u32 R5900DebugInterface::read16(u32 address)
|
||||||
{
|
{
|
||||||
if (!isValidAddress(address))
|
return readMemory(address,2);
|
||||||
return -1;
|
|
||||||
return memRead16(address);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 R5900DebugInterface::read32(u32 address)
|
u32 R5900DebugInterface::read32(u32 address)
|
||||||
{
|
{
|
||||||
if (!isValidAddress(address))
|
return readMemory(address,4);
|
||||||
return -1;
|
|
||||||
return memRead32(address);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 R5900DebugInterface::read64(u32 address)
|
u64 R5900DebugInterface::read64(u32 address)
|
||||||
|
@ -231,7 +258,19 @@ u64 R5900DebugInterface::read64(u32 address)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
u64 result;
|
u64 result;
|
||||||
|
|
||||||
|
// TODO: Add linux variant of the following __try/__except
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
__try {
|
||||||
|
#endif
|
||||||
memRead64(address,result);
|
memRead64(address,result);
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
} __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||||
|
{
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,8 +279,20 @@ u128 R5900DebugInterface::read128(u32 address)
|
||||||
if (!isValidAddress(address))
|
if (!isValidAddress(address))
|
||||||
return u128::From32(-1);
|
return u128::From32(-1);
|
||||||
|
|
||||||
u128 result;
|
__aligned16 u128 result;
|
||||||
|
|
||||||
|
// TODO: Add linux variant of the following __try/__except
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
__try {
|
||||||
|
#endif
|
||||||
memRead128(address,result);
|
memRead128(address,result);
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
} __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||||
|
{
|
||||||
|
result.hi = result.lo = -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@ public:
|
||||||
virtual std::string disasm(u32 address);
|
virtual std::string disasm(u32 address);
|
||||||
virtual bool isValidAddress(u32 address);
|
virtual bool isValidAddress(u32 address);
|
||||||
virtual u32 getCycles();
|
virtual u32 getCycles();
|
||||||
|
private:
|
||||||
|
u32 readMemory(u32 address, u32 size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -337,6 +337,9 @@ namespace MIPSAnalyst
|
||||||
case 0x2C: // sdl
|
case 0x2C: // sdl
|
||||||
size = 8;
|
size = 8;
|
||||||
off = -7;
|
off = -7;
|
||||||
|
case 0x1E: // lq
|
||||||
|
case 0x1F: // sq
|
||||||
|
size = 16;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -757,14 +757,14 @@ void Pcsx2App::enterDebugMode()
|
||||||
{
|
{
|
||||||
DisassemblyDialog* dlg = GetDisassemblyPtr();
|
DisassemblyDialog* dlg = GetDisassemblyPtr();
|
||||||
if (dlg)
|
if (dlg)
|
||||||
dlg->setDebugMode(true);
|
dlg->setDebugMode(true,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2App::leaveDebugMode()
|
void Pcsx2App::leaveDebugMode()
|
||||||
{
|
{
|
||||||
DisassemblyDialog* dlg = GetDisassemblyPtr();
|
DisassemblyDialog* dlg = GetDisassemblyPtr();
|
||||||
if (dlg)
|
if (dlg)
|
||||||
dlg->setDebugMode(false);
|
dlg->setDebugMode(false,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pcsx2App::resetDebugger()
|
void Pcsx2App::resetDebugger()
|
||||||
|
|
|
@ -811,7 +811,7 @@ void CtrlDisassemblyView::updateStatusBarText()
|
||||||
}
|
}
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
u128 data = cpu->read128(line.info.dataAddress);
|
__aligned16 u128 data = cpu->read128(line.info.dataAddress);
|
||||||
sprintf(text,"[%08X] = %016llX%016llX",line.info.dataAddress,data._u64[1],data._u64[0]);
|
sprintf(text,"[%08X] = %016llX%016llX",line.info.dataAddress,data._u64[1],data._u64[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ DisassemblyDialog::DisassemblyDialog(wxWindow* parent):
|
||||||
SetMinSize(wxSize(1000,600));
|
SetMinSize(wxSize(1000,600));
|
||||||
panel->GetSizer()->Fit(this);
|
panel->GetSizer()->Fit(this);
|
||||||
|
|
||||||
setDebugMode(true);
|
setDebugMode(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -212,8 +212,10 @@ void DisassemblyDialog::onBreakRunClicked(wxCommandEvent& evt)
|
||||||
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
|
// If the current PC is on a breakpoint, the user doesn't want to do nothing.
|
||||||
CBreakPoints::SetSkipFirst(r5900Debug.getPC());
|
CBreakPoints::SetSkipFirst(r5900Debug.getPC());
|
||||||
r5900Debug.resumeCpu();
|
r5900Debug.resumeCpu();
|
||||||
} else
|
} else {
|
||||||
r5900Debug.pauseCpu();
|
r5900Debug.pauseCpu();
|
||||||
|
gotoPc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisassemblyDialog::onStepOverClicked(wxCommandEvent& evt)
|
void DisassemblyDialog::onStepOverClicked(wxCommandEvent& evt)
|
||||||
|
@ -352,6 +354,8 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
|
||||||
wxEventType type = evt.GetEventType();
|
wxEventType type = evt.GetEventType();
|
||||||
if (type == debEVT_SETSTATUSBARTEXT)
|
if (type == debEVT_SETSTATUSBARTEXT)
|
||||||
{
|
{
|
||||||
|
CtrlDisassemblyView* view = reinterpret_cast<CtrlDisassemblyView*>(evt.GetEventObject());
|
||||||
|
if (view != NULL && view == currentCpu->getDisassembly())
|
||||||
GetStatusBar()->SetLabel(evt.GetString());
|
GetStatusBar()->SetLabel(evt.GetString());
|
||||||
} else if (type == debEVT_UPDATELAYOUT)
|
} else if (type == debEVT_UPDATELAYOUT)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +424,13 @@ void DisassemblyDialog::reset()
|
||||||
iopTab->getDisassembly()->clearFunctions();
|
iopTab->getDisassembly()->clearFunctions();
|
||||||
};
|
};
|
||||||
|
|
||||||
void DisassemblyDialog::setDebugMode(bool debugMode)
|
void DisassemblyDialog::gotoPc()
|
||||||
|
{
|
||||||
|
eeTab->getDisassembly()->gotoPc();
|
||||||
|
iopTab->getDisassembly()->gotoPc();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisassemblyDialog::setDebugMode(bool debugMode, bool switchPC)
|
||||||
{
|
{
|
||||||
bool running = r5900Debug.isAlive();
|
bool running = r5900Debug.isAlive();
|
||||||
|
|
||||||
|
@ -437,8 +447,8 @@ void DisassemblyDialog::setDebugMode(bool debugMode)
|
||||||
stepOverButton->Enable(true);
|
stepOverButton->Enable(true);
|
||||||
stepIntoButton->Enable(true);
|
stepIntoButton->Enable(true);
|
||||||
|
|
||||||
eeTab->getDisassembly()->gotoPc();
|
if (switchPC || CBreakPoints::GetBreakpointTriggered())
|
||||||
iopTab->getDisassembly()->gotoPc();
|
gotoPc();
|
||||||
|
|
||||||
if (CBreakPoints::GetBreakpointTriggered())
|
if (CBreakPoints::GetBreakpointTriggered())
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
void reset();
|
void reset();
|
||||||
void setDebugMode(bool debugMode);
|
void setDebugMode(bool debugMode, bool switchPC);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
@ -79,6 +79,7 @@ protected:
|
||||||
void onClose(wxCloseEvent& evt);
|
void onClose(wxCloseEvent& evt);
|
||||||
void stepOver();
|
void stepOver();
|
||||||
void stepInto();
|
void stepInto();
|
||||||
|
void gotoPc();
|
||||||
private:
|
private:
|
||||||
CpuTabPage* eeTab;
|
CpuTabPage* eeTab;
|
||||||
CpuTabPage* iopTab;
|
CpuTabPage* iopTab;
|
||||||
|
|
Loading…
Reference in New Issue