MemoryView can now view ARAM (rightclick -> toggle memory). Add "search for instruction" capability to debugger. Code cleanup, log zelda pb type (9 all the time in Zelda Four Swords)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3479 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-06-17 19:50:59 +00:00
parent 9d9ce4274b
commit 51cbdea782
19 changed files with 199 additions and 194 deletions

View File

@ -283,9 +283,11 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
// Insert blr or restore old value
case IDM_INSERTBLR:
InsertBlrNop(0);
redraw();
break;
case IDM_INSERTNOP:
InsertBlrNop(1);
redraw();
break;
case IDM_JITRESULTS:

View File

@ -46,6 +46,7 @@
#include "FileUtil.h"
#include "Core.h"
#include "HW/Memmap.h"
#include "HLE/HLE.h"
#include "Boot/Boot.h"
#include "LogManager.h"
@ -140,6 +141,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_CLEARCODECACHE, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_PROFILEBLOCKS, CCodeWindow::OnProfilerMenu)
EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
@ -656,6 +658,18 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event)
case IDM_CLEARCODECACHE:
jit.ClearCache(); break;
case IDM_SEARCHINSTRUCTION:
{
wxString str;
str = wxGetTextFromUser("", "Op?", wxEmptyString, this);
for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4) {
const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr));
if (name && !strcmp(str.c_str(), name))
NOTICE_LOG(POWERPC, "Found %s at %08x", str.c_str(), addr);
}
break;
}
}
}
// =====================================

View File

@ -106,6 +106,7 @@ class CCodeWindow
// JIT
IDM_CLEARCODECACHE,
IDM_LOGINSTRUCTIONS,
IDM_SEARCHINSTRUCTION,
// Profiler
IDM_PROFILEBLOCKS,

View File

@ -110,6 +110,7 @@ void CCodeWindow::CreateSymbolsMenu()
wxMenu *pJitMenu = new wxMenu;
pJitMenu->Append(IDM_CLEARCODECACHE, _T("&Clear code cache"));
pJitMenu->Append(IDM_LOGINSTRUCTIONS, _T("&Log JIT instruction coverage"));
pJitMenu->Append(IDM_SEARCHINSTRUCTION, _T("&Search for an op"));
pMenuBar->Append(pJitMenu, _T("&JIT"));
wxMenu *pProfilerMenu = new wxMenu;

View File

@ -31,6 +31,7 @@ enum
IDM_COPYCODE,
IDM_RUNTOHERE,
IDM_DYNARECRESULTS,
IDM_TOGGLEMEMORY,
};
@ -54,7 +55,8 @@ CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWin
selectionChanged(false),
selecting(false),
hasFocus(false),
showHex(false)
showHex(false),
memory(0)
{
rowHeight = 13;
align = debuginterface->getInstructionSize(0);
@ -169,10 +171,15 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
case IDM_COPYHEX:
{
char temp[24];
sprintf(temp, "%08x", debugger->readMemory(selection));
sprintf(temp, "%08x", debugger->readExtraMemory(memory, selection));
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp)));
}
break;
break;
case IDM_TOGGLEMEMORY:
memory ^= 1;
redraw();
break;
#endif
}
@ -192,6 +199,7 @@ void CMemoryView::OnMouseUpR(wxMouseEvent& event)
menu.Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
menu.Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
#endif
menu.Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory (RAM/ARAM)"));
PopupMenu(&menu);
event.Skip(true);
}
@ -276,7 +284,7 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
dc.SetTextForeground(_T("#600000"));
dc.DrawText(temp, 17, rowY1);
char mem[256];
debugger->getRawMemoryString(address, mem, 256);
debugger->getRawMemoryString(memory, address, mem, 256);
dc.SetTextForeground(_T("#000080"));
dc.DrawText(wxString::FromAscii(mem), 17+fontSize*(8), rowY1);
dc.SetTextForeground(_T("#000000"));
@ -284,12 +292,12 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
if (debugger->isAlive())
{
char dis[256] = {0};
u32 mem = debugger->readMemory(address);
u32 mem = debugger->readExtraMemory(memory, address);
float flt = *(float *)(&mem);
sprintf(dis, "f: %f", flt);
char desc[256] = "";
dc.DrawText(wxString::FromAscii(dis), 17 + fontSize*(8 + 8), rowY1);
dc.DrawText(wxString::FromAscii(dis), 77 + fontSize*(8 + 8), rowY1);
if (desc[0] == 0)
{

View File

@ -22,55 +22,47 @@
#include "Common.h"
#include "Debugger/DebugInterface.h"
class CMemoryView
: public wxControl
class CMemoryView : public wxControl
{
public:
public:
CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize);
wxSize DoGetBestSize() const;
void OnPaint(wxPaintEvent& event);
void OnErase(wxEraseEvent& event);
void OnMouseDown(wxMouseEvent& event);
void OnMouseMove(wxMouseEvent& event);
void OnMouseUpL(wxMouseEvent& event);
void OnMouseUpR(wxMouseEvent& event);
void OnPopupMenu(wxCommandEvent& event);
CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWindowID Id = -1, const wxSize& Size = wxDefaultSize);
wxSize DoGetBestSize() const;
void OnPaint(wxPaintEvent& event);
void OnErase(wxEraseEvent& event);
void OnMouseDown(wxMouseEvent& event);
void OnMouseMove(wxMouseEvent& event);
void OnMouseUpL(wxMouseEvent& event);
void OnMouseUpR(wxMouseEvent& event);
void OnPopupMenu(wxCommandEvent& event);
u32 GetSelection() {return(selection);}
void Center(u32 addr)
{
curAddress = addr;
redraw();
}
u32 GetSelection() {return(selection);}
private:
int YToAddress(int y);
void redraw() {Refresh();}
DebugInterface* debugger;
void Center(u32 addr)
{
curAddress = addr;
redraw();
}
int curAddress;
int align;
int rowHeight;
u32 selection;
u32 oldSelection;
bool selectionChanged;
bool selecting;
bool hasFocus;
bool showHex;
private:
int memory;
int YToAddress(int y);
void redraw() {Refresh();}
DebugInterface* debugger;
int curAddress;
int align;
int rowHeight;
u32 selection;
u32 oldSelection;
bool selectionChanged;
bool selecting;
bool hasFocus;
bool showHex;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#endif /*MEMORYVIEW_H_*/

View File

@ -42,24 +42,11 @@
enum
{
IDM_DEBUG_GO = 350,
IDM_STEP,
IDM_STEPOVER,
IDM_SKIP,
IDM_SETPC,
IDM_GOTOPC,
IDM_ADDRBOX,
IDM_CALLSTACKLIST,
IDM_ADDRBOX = 350,
IDM_SYMBOLLIST,
IDM_INTERPRETER,
IDM_DUALCORE,
IDM_LOGWINDOW,
IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW,
IDM_VALBOX,
IDM_SETVALBUTTON,
IDM_DUMP_MEMORY,
IDM_VALBOX,
};
BEGIN_EVENT_TABLE(CMemoryWindow, wxFrame)
@ -70,7 +57,6 @@ BEGIN_EVENT_TABLE(CMemoryWindow, wxFrame)
EVT_BUTTON(IDM_DUMP_MEMORY, CMemoryWindow::OnDumpMemory)
END_EVENT_TABLE()
CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
const wxString& title, const wxPoint& pos, const wxSize& size, long style)
: wxFrame(parent, id, title, pos, size, style)
@ -87,9 +73,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
//sizerBig->Add(sizerLeft, 1, wxEXPAND);
sizerBig->Add(memview, 20, wxEXPAND);
sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3);
sizerRight->Add(buttonGo = new wxButton(this, IDM_DEBUG_GO, _T("&Go")));
sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_ADDRBOX, _T("")));
sizerRight->Add(new wxButton(this, IDM_SETPC, _T("S&et PC")));
sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, _T("")));
sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _T("Set &Value")));
@ -162,14 +146,15 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
Memory::Write_U32(val, addr);
memview->Refresh();
}
void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event)
{
wxString txt = addrbox->GetValue();
if (txt.size() == 8)
if (txt.size())
{
u32 addr;
sscanf(txt.mb_str(), "%08x", &addr);
memview->Center(addr);
memview->Center(addr & ~3);
}
event.Skip(1);