mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Module list in Windows debugger
This commit is contained in:
parent
8fa6105472
commit
880be6d41d
@ -463,6 +463,25 @@ bool SymbolMap::IsModuleActive(int moduleIndex) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<LoadedModuleInfo> SymbolMap::getAllModules() const {
|
||||
lock_guard guard(lock_);
|
||||
|
||||
std::vector<LoadedModuleInfo> result;
|
||||
for (size_t i = 0; i < modules.size(); i++) {
|
||||
LoadedModuleInfo m;
|
||||
m.name = modules[i].name;
|
||||
m.address = modules[i].start;
|
||||
m.size = modules[i].size;
|
||||
|
||||
u32 key = modules[i].start + modules[i].size;
|
||||
m.active = activeModuleEnds.find(key) != activeModuleEnds.end();
|
||||
|
||||
result.push_back(m);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void SymbolMap::AddFunction(const char* name, u32 address, u32 size, int moduleIndex) {
|
||||
lock_guard guard(lock_);
|
||||
|
||||
|
@ -45,6 +45,13 @@ struct SymbolEntry {
|
||||
u32 size;
|
||||
};
|
||||
|
||||
struct LoadedModuleInfo {
|
||||
std::string name;
|
||||
u32 address;
|
||||
u32 size;
|
||||
bool active;
|
||||
};
|
||||
|
||||
enum DataType {
|
||||
DATATYPE_NONE, DATATYPE_BYTE, DATATYPE_HALFWORD, DATATYPE_WORD, DATATYPE_ASCII
|
||||
};
|
||||
@ -80,6 +87,7 @@ public:
|
||||
u32 GetModuleAbsoluteAddr(u32 relative, int moduleIndex) const;
|
||||
int GetModuleIndex(u32 address) const;
|
||||
bool IsModuleActive(int moduleIndex) const;
|
||||
std::vector<LoadedModuleInfo> getAllModules() const;
|
||||
|
||||
void AddFunction(const char* name, u32 address, u32 size, int moduleIndex = -1);
|
||||
u32 GetFunctionStart(u32 address) const;
|
||||
|
@ -163,6 +163,10 @@ CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Di
|
||||
stackTraceView->loadStackTrace();
|
||||
bottomTabs->AddTab(stackTraceView->GetHandle(),L"Stack frames");
|
||||
|
||||
moduleList = new CtrlModuleList(GetDlgItem(m_hDlg,IDC_MODULELIST),cpu);
|
||||
moduleList->loadModules();
|
||||
bottomTabs->AddTab(moduleList->GetHandle(),L"Modules");
|
||||
|
||||
bottomTabs->SetShowTabTitles(g_Config.bShowBottomTabTitles);
|
||||
bottomTabs->ShowTab(memHandle);
|
||||
|
||||
@ -367,6 +371,9 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case IDC_STACKFRAMES:
|
||||
stackTraceView->HandleNotify(lParam);
|
||||
break;
|
||||
case IDC_MODULELIST:
|
||||
moduleList->HandleNotify(lParam);
|
||||
break;
|
||||
case IDC_DEBUG_BOTTOMTABS:
|
||||
bottomTabs->HandleNotify(lParam);
|
||||
break;
|
||||
@ -775,6 +782,7 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
|
||||
breakpointList->reloadBreakpoints();
|
||||
threadList->reloadThreads();
|
||||
stackTraceView->loadStackTrace();
|
||||
moduleList->loadModules();
|
||||
updateThreadLabel(false);
|
||||
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
|
||||
|
@ -26,6 +26,7 @@ private:
|
||||
CtrlBreakpointList* breakpointList;
|
||||
CtrlThreadList* threadList;
|
||||
CtrlStackTraceView* stackTraceView;
|
||||
CtrlModuleList* moduleList;
|
||||
TabControl* leftTabs;
|
||||
TabControl* bottomTabs;
|
||||
std::vector<BreakPoint> displayedBreakPoints_;
|
||||
|
@ -15,6 +15,7 @@ static const int numCPUs = 1;
|
||||
enum { TL_NAME, TL_PROGRAMCOUNTER, TL_ENTRYPOINT, TL_PRIORITY, TL_STATE, TL_WAITTYPE, TL_COLUMNCOUNT };
|
||||
enum { BPL_TYPE, BPL_OFFSET, BPL_SIZELABEL, BPL_OPCODE, BPL_CONDITION, BPL_HITS, BPL_ENABLED, BPL_COLUMNCOUNT };
|
||||
enum { SF_ENTRY, SF_ENTRYNAME, SF_CURPC, SF_CUROPCODE, SF_CURSP, SF_FRAMESIZE, SF_COLUMNCOUNT };
|
||||
enum { ML_NAME, ML_ADDRESS, ML_SIZE, ML_ACTIVE, ML_COLUMNCOUNT };
|
||||
|
||||
GenericListViewColumn threadColumns[TL_COLUMNCOUNT] = {
|
||||
{ L"Name", 0.20f },
|
||||
@ -44,6 +45,13 @@ GenericListViewColumn stackTraceColumns[SF_COLUMNCOUNT] = {
|
||||
{ L"Frame Size", 0.12f }
|
||||
};
|
||||
|
||||
GenericListViewColumn moduleListColumns[ML_COLUMNCOUNT] = {
|
||||
{ L"Name", 0.25f },
|
||||
{ L"Address", 0.25f },
|
||||
{ L"Size", 0.25f },
|
||||
{ L"Active", 0.25f },
|
||||
};
|
||||
|
||||
const int POPUP_SUBMENU_ID_BREAKPOINTLIST = 5;
|
||||
const int POPUP_SUBMENU_ID_THREADLIST = 6;
|
||||
const int POPUP_SUBMENU_ID_NEWBREAKPOINT = 7;
|
||||
@ -695,3 +703,74 @@ void CtrlStackTraceView::loadStackTrace()
|
||||
}
|
||||
Update();
|
||||
}
|
||||
|
||||
//
|
||||
// CtrlModuleList
|
||||
//
|
||||
|
||||
CtrlModuleList::CtrlModuleList(HWND hwnd, DebugInterface* cpu)
|
||||
: GenericListControl(hwnd,moduleListColumns,ML_COLUMNCOUNT),cpu(cpu)
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
bool CtrlModuleList::WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB)
|
||||
{
|
||||
returnValue = 0;
|
||||
SendMessage(GetParent(GetHandle()),WM_DEB_TABPRESSED,0,0);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case WM_GETDLGCODE:
|
||||
if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN)
|
||||
{
|
||||
if (wParam == VK_TAB || wParam == VK_RETURN)
|
||||
{
|
||||
returnValue = DLGC_WANTMESSAGE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CtrlModuleList::GetColumnText(wchar_t* dest, int row, int col)
|
||||
{
|
||||
if (row < 0 || row >= (int)modules.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (col)
|
||||
{
|
||||
case ML_NAME:
|
||||
wcscpy(dest,ConvertUTF8ToWString(modules[row].name).c_str());
|
||||
break;
|
||||
case ML_ADDRESS:
|
||||
wsprintf(dest,L"%08X",modules[row].address);
|
||||
break;
|
||||
case ML_SIZE:
|
||||
wsprintf(dest,L"%08X",modules[row].size);
|
||||
break;
|
||||
case ML_ACTIVE:
|
||||
wcscpy(dest,modules[row].active ? L"true" : L"false");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CtrlModuleList::OnDoubleClick(int itemIndex, int column)
|
||||
{
|
||||
SendMessage(GetParent(GetHandle()),WM_DEB_GOTOWPARAM,modules[itemIndex].address,0);
|
||||
}
|
||||
|
||||
void CtrlModuleList::loadModules()
|
||||
{
|
||||
modules = symbolMap.getAllModules();
|
||||
Update();
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "../../Core/Debugger/DebugInterface.h"
|
||||
#include "../../Core/HLE/sceKernelThread.h"
|
||||
#include "../../Core/Debugger/Breakpoints.h"
|
||||
#include "../../Core/Debugger/SymbolMap.h"
|
||||
#include "../../Core/MIPS/MIPSStackWalk.h"
|
||||
#include "Windows/W32Util/Misc.h"
|
||||
|
||||
@ -67,4 +68,19 @@ private:
|
||||
std::vector<MIPSStackWalk::StackFrame> frames;
|
||||
DebugInterface* cpu;
|
||||
CtrlDisAsmView* disasm;
|
||||
};
|
||||
|
||||
class CtrlModuleList: public GenericListControl
|
||||
{
|
||||
public:
|
||||
CtrlModuleList(HWND hwnd, DebugInterface* cpu);
|
||||
void loadModules();
|
||||
protected:
|
||||
virtual bool WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue);
|
||||
virtual void GetColumnText(wchar_t* dest, int row, int col);
|
||||
virtual int GetRowCount() { return (int)modules.size(); };
|
||||
virtual void OnDoubleClick(int itemIndex, int column);
|
||||
private:
|
||||
std::vector<LoadedModuleInfo> modules;
|
||||
DebugInterface* cpu;
|
||||
};
|
@ -162,6 +162,7 @@ BEGIN
|
||||
CONTROL "Custom2",IDC_DEBUGMEMVIEW,"CtrlMemView",WS_BORDER,1,338,513,93
|
||||
CONTROL "",IDC_THREADLIST,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93
|
||||
CONTROL "",IDC_STACKFRAMES,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93
|
||||
CONTROL "",IDC_MODULELIST,"SysListView32",LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT | WS_BORDER,1,338,513,93
|
||||
CONTROL "",IDC_DEBUG_BOTTOMTABS,"SysTabControl32",TCS_TABS | TCS_FOCUSNEVER,1,338,513,93
|
||||
END
|
||||
|
||||
|
@ -300,6 +300,7 @@
|
||||
#define ID_EMULATION_SWITCH_UMD 40144
|
||||
#define ID_DEBUG_EXTRACTFILE 40145
|
||||
#define ID_OPTIONS_IGNOREWINKEY 40146
|
||||
#define IDC_MODULELIST 40147
|
||||
|
||||
// Dummy option to let the buffered rendering hotkey cycle through all the options.
|
||||
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
|
||||
|
Loading…
Reference in New Issue
Block a user