pcsx2 debugger: be more friendly with linux

* Fix a couple of gcc warning and replace deprecated function
* Fix the redraw of the memory zone
* Avoid a crash if we breakpoint before running
* Use %s on linux because %S isn't supported
* Properly check .result in recMemCheck. Add some code to print hit
  breakpoint.
* breakpoint window isn't properly resized so used a static size as a
  temporary workaround
This commit is contained in:
Gregory Hainaut 2014-03-25 17:31:52 +01:00
parent e59b252cc0
commit 0980591fa2
6 changed files with 56 additions and 8 deletions

View File

@ -6,6 +6,7 @@
#include "AppCoreThread.h"
#include "Debug.h"
#include "../VU.h"
#include "Counters.h"
#include "../R3000A.h"
#include "../IopMem.h"
@ -149,7 +150,7 @@ private:
bool DebugInterface::isAlive()
{
return GetCoreThread().IsOpen();
return GetCoreThread().IsOpen() && g_FrameCount > 0;
}
bool DebugInterface::isCpuPaused()

View File

@ -291,7 +291,7 @@ void CtrlDisassemblyView::drawBranchLine(wxDC& dc, std::map<u32,int>& addressPos
int getBackgroundColor(unsigned int address)
{
int colors[6] = {0xFFe0FFFF,0xFFFFe0e0,0xFFe8e8FF,0xFFFFe0FF,0xFFe0FFe0,0xFFFFFFe0};
u32 colors[6] = {0xFFe0FFFF,0xFFFFe0e0,0xFFe8e8FF,0xFFFFe0FF,0xFFe0FFe0,0xFFFFFFe0};
int n=symbolMap.GetFunctionNum(address);
if (n==-1) return 0xFFFFFFFF;
return colors[n%6];

View File

@ -108,6 +108,14 @@ void CtrlMemView::render(wxDC& dc)
bool hasFocus = wxWindow::FindFocus() == this;
int visibleRows = GetClientSize().y/rowHeight;
wxColor white = wxColor(0xFFFFFFFF);
dc.SetBrush(wxBrush(white));
dc.SetPen(wxPen(white));
int width,height;
dc.GetSize(&width,&height);
dc.DrawRectangle(0,0,width,height);
for (int i = 0; i < visibleRows+1; i++)
{
wchar_t temp[32];

View File

@ -53,7 +53,7 @@ CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu)
}
SetDoubleBuffered(true);
SetInitialBestSize(ClientToWindowSize(GetMinClientSize()));
SetInitialSize(ClientToWindowSize(GetMinClientSize()));
}
void CtrlRegisterList::postEvent(wxEventType type, wxString text)
@ -341,19 +341,19 @@ void CtrlRegisterList::onPopupClick(wxCommandEvent& evt)
{
case ID_REGISTERLIST_DISPLAY32:
maxBits = 32;
SetBestSize(ClientToWindowSize(GetMinClientSize()));
SetInitialSize(ClientToWindowSize(GetMinClientSize()));
postEvent(debEVT_UPDATELAYOUT,0);
Refresh();
break;
case ID_REGISTERLIST_DISPLAY64:
maxBits = 64;
SetBestSize(ClientToWindowSize(GetMinClientSize()));
SetInitialSize(ClientToWindowSize(GetMinClientSize()));
postEvent(debEVT_UPDATELAYOUT,0);
Refresh();
break;
case ID_REGISTERLIST_DISPLAY128:
maxBits = 128;
SetBestSize(ClientToWindowSize(GetMinClientSize()));
SetInitialSize(ClientToWindowSize(GetMinClientSize()));
postEvent(debEVT_UPDATELAYOUT,0);
Refresh();
break;

View File

@ -49,6 +49,11 @@ GenericListViewColumn breakpointColumns[BPL_COLUMNCOUNT] = {
BreakpointList::BreakpointList(wxWindow* parent, DebugInterface* _cpu, CtrlDisassemblyView* _disassembly)
: wxListView(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxLC_VIRTUAL|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER), cpu(_cpu), disasm(_disassembly)
{
#ifdef __LINUX__
// On linux wx failed to resize properly the page. I don't know why so for the moment I just create a static size page
// Far from ideal but at least I can use the memory window!
this->SetSize(wxSize(1000, 200));
#endif
insertListViewColumns(this,breakpointColumns,BPL_COLUMNCOUNT);
}
@ -130,7 +135,11 @@ wxString BreakpointList::OnGetItemText(long item, long col) const
const std::string sym = symbolMap.GetLabelString(displayedBreakPoints_[index].addr);
if (!sym.empty())
{
#ifdef __LINUX__
swprintf(dest,256,L"%s",sym.c_str());
#else
swprintf(dest,256,L"%S",sym.c_str());
#endif
} else {
wcscpy(dest,L"-");
}
@ -144,7 +153,11 @@ wxString BreakpointList::OnGetItemText(long item, long col) const
} else {
char temp[256];
disasm->getOpcodeText(displayedBreakPoints_[index].addr, temp);
#ifdef __LINUX__
swprintf(dest,256,L"%s",temp);
#else
swprintf(dest,256,L"%S",temp);
#endif
}
}
break;
@ -153,7 +166,11 @@ wxString BreakpointList::OnGetItemText(long item, long col) const
if (isMemory || displayedBreakPoints_[index].hasCond == false) {
wcscpy(dest,L"-");
} else {
#ifdef __LINUX__
swprintf(dest,256,L"%s",displayedBreakPoints_[index].cond.expressionString);
#else
swprintf(dest,256,L"%S",displayedBreakPoints_[index].cond.expressionString);
#endif
}
}
break;
@ -169,9 +186,17 @@ wxString BreakpointList::OnGetItemText(long item, long col) const
case BPL_ENABLED:
{
if (isMemory) {
#ifdef __LINUX__
swprintf(dest,256,L"%s",displayedMemChecks_[index].cond & MEMCHECK_BREAK ? "true" : "false");
#else
swprintf(dest,256,L"%S",displayedMemChecks_[index].cond & MEMCHECK_BREAK ? "true" : "false");
#endif
} else {
#ifdef __LINUX__
swprintf(dest,256,L"%s",displayedBreakPoints_[index].enabled ? "true" : "false");
#else
swprintf(dest,256,L"%S",displayedBreakPoints_[index].enabled ? "true" : "false");
#endif
}
}
break;

View File

@ -1295,6 +1295,14 @@ void dynarecMemcheck()
recExitExecution();
}
__fastcall void dynarecMemLogcheck(u32 start, bool store)
{
if (store)
DevCon.WriteLn("Hit store breakpoint @0x%x", start);
else
DevCon.WriteLn("Hit load breakpoint @0x%x", start);
}
void recMemcheck(u32 bits, bool store)
{
iFlushCall(FLUSH_INTERPRETER);
@ -1315,7 +1323,7 @@ void recMemcheck(u32 bits, bool store)
auto checks = CBreakPoints::GetMemChecks();
for (size_t i = 0; i < checks.size(); i++)
{
if ((checks[i].cond & MEMCHECK_BREAK) == 0)
if (checks[i].result == 0)
continue;
if ((checks[i].cond & MEMCHECK_WRITE) == 0 && store == true)
continue;
@ -1333,7 +1341,13 @@ void recMemcheck(u32 bits, bool store)
xForwardJGE8 next2; // if start >= address+size then goto next2
// hit the breakpoint
if (checks[i].result & MEMCHECK_LOG) {
xMOV(edx, store);
xCALL(&dynarecMemLogcheck);
}
if (checks[i].result & MEMCHECK_BREAK) {
xCALL(&dynarecMemcheck);
}
next1.SetTarget();
next2.SetTarget();