mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-28 02:41:18 +00:00
commit
69d14879b2
@ -1023,6 +1023,8 @@ if(WIN32)
|
||||
Windows/Debugger/Debugger_Disasm.h
|
||||
Windows/Debugger/Debugger_MemoryDlg.cpp
|
||||
Windows/Debugger/Debugger_MemoryDlg.h
|
||||
Windows/Debugger/Debugger_Lists.cpp
|
||||
Windows/Debugger/Debugger_Lists.h
|
||||
Windows/Debugger/Debugger_Misc.cpp
|
||||
Windows/Debugger/Debugger_Misc.h
|
||||
# Windows/Debugger/Debugger_Profiler.cpp
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "..\..\Core\Debugger\DebugInterface.h"
|
||||
|
||||
enum { WM_DEB_RUNTOWPARAM = WM_USER+2,
|
||||
WM_DEB_GOTOWPARAM,
|
||||
WM_DEB_GOTOBREAKPOINT,
|
||||
WM_DEB_REMOVEBREAKPOINT,
|
||||
WM_DEB_GOTOADDRESSEDIT,
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "../main.h"
|
||||
#include "CtrlRegisterList.h"
|
||||
#include "CtrlMemView.h"
|
||||
#include "Debugger_Lists.h"
|
||||
|
||||
#include "../../Core/Core.h"
|
||||
#include "../../Core/CPU.h"
|
||||
@ -193,9 +194,14 @@ CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Di
|
||||
CtrlMemView *mem = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW));
|
||||
mem->setDebugger(_cpu);
|
||||
|
||||
threadList = new CtrlThreadList();
|
||||
threadList->setDialogItem(GetDlgItem(m_hDlg,IDC_THREADLIST));
|
||||
threadList->reloadThreads();
|
||||
|
||||
// init memory/breakpoint "tab"
|
||||
ShowWindow(GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST), SW_NORMAL);
|
||||
ShowWindow(GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST), SW_HIDE);
|
||||
ShowWindow(GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW), SW_NORMAL);
|
||||
ShowWindow(GetDlgItem(m_hDlg, IDC_THREADLIST), SW_HIDE);
|
||||
|
||||
// Actually resize the window to the proper size (after the above setup.)
|
||||
if (w != -1 && h != -1)
|
||||
@ -475,6 +481,9 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case IDC_BREAKPOINTLIST:
|
||||
handleBreakpointNotify(lParam);
|
||||
break;
|
||||
case IDC_THREADLIST:
|
||||
threadList->handleNotify(lParam);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
@ -744,6 +753,13 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
Core_EnableStepping(false);
|
||||
break;
|
||||
}
|
||||
case WM_DEB_GOTOWPARAM:
|
||||
{
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
ptr->gotoAddr(wParam);
|
||||
SetFocus(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
break;
|
||||
}
|
||||
case WM_DEB_GOTOBREAKPOINT:
|
||||
gotoBreakpointAddress(wParam);
|
||||
break;
|
||||
@ -775,15 +791,24 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND bp = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST);
|
||||
HWND mem = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW);
|
||||
HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST);
|
||||
|
||||
if (IsWindowVisible(bp))
|
||||
{
|
||||
ShowWindow(bp,SW_HIDE);
|
||||
ShowWindow(mem,SW_HIDE);
|
||||
ShowWindow(threads,SW_NORMAL);
|
||||
SetFocus(threads);
|
||||
} else if (IsWindowVisible(threads))
|
||||
{
|
||||
ShowWindow(bp,SW_HIDE);
|
||||
ShowWindow(mem,SW_NORMAL);
|
||||
ShowWindow(threads,SW_HIDE);
|
||||
SetFocus(mem);
|
||||
} else {
|
||||
ShowWindow(bp,SW_NORMAL);
|
||||
ShowWindow(mem,SW_HIDE);
|
||||
ShowWindow(threads,SW_HIDE);
|
||||
SetFocus(bp);
|
||||
}
|
||||
}
|
||||
@ -821,6 +846,7 @@ void CDisasm::UpdateSize(WORD width, WORD height)
|
||||
HWND regList = GetDlgItem(m_hDlg, IDC_REGLIST);
|
||||
HWND breakpointList = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST);
|
||||
HWND memView = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW);
|
||||
HWND threads = GetDlgItem(m_hDlg, IDC_THREADLIST);
|
||||
|
||||
int defaultHeight = defaultRect.bottom - defaultRect.top;
|
||||
int breakpointHeight = defaultBreakpointRect.bottom - defaultBreakpointRect.top;
|
||||
@ -838,6 +864,7 @@ void CDisasm::UpdateSize(WORD width, WORD height)
|
||||
MoveWindow(disasm,regWidth+15,disasmTop,disasmWidth-20,height-disasmTop-breakpointHeight-12,TRUE);
|
||||
MoveWindow(breakpointList,8,breakpointTop,width-16,breakpointHeight,TRUE);
|
||||
MoveWindow(memView,8,breakpointTop,width-16,breakpointHeight,TRUE);
|
||||
MoveWindow(threads,8,breakpointTop,width-16,breakpointHeight,TRUE);
|
||||
|
||||
GetWindowRect(GetDlgItem(m_hDlg, IDC_REGLIST),®Rect);
|
||||
GetWindowRect(GetDlgItem(m_hDlg, IDC_DISASMVIEW),&disRect);
|
||||
@ -872,6 +899,7 @@ void CDisasm::SetDebugMode(bool _bDebug)
|
||||
Core_WaitInactive(TEMP_BREAKPOINT_WAIT_MS);
|
||||
CBreakPoints::ClearTemporaryBreakPoints();
|
||||
updateBreakpointList();
|
||||
threadList->reloadThreads();
|
||||
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_GO), TRUE);
|
||||
EnableWindow( GetDlgItem(hDlg, IDC_STEP), TRUE);
|
||||
|
@ -17,6 +17,8 @@
|
||||
// Takes lParam for debug mode, zero or non zero.
|
||||
const int WM_DISASM_SETDEBUG = WM_APP + 0;
|
||||
|
||||
class CtrlThreadList;
|
||||
|
||||
class CDisasm : public Dialog
|
||||
{
|
||||
private:
|
||||
@ -29,6 +31,7 @@ private:
|
||||
DebugInterface *cpu;
|
||||
u64 lastTicks;
|
||||
|
||||
CtrlThreadList* threadList;
|
||||
std::vector<BreakPoint> displayedBreakPoints_;
|
||||
std::vector<MemCheck> displayedMemChecks_;
|
||||
|
||||
|
170
Windows/Debugger/Debugger_Lists.cpp
Normal file
170
Windows/Debugger/Debugger_Lists.cpp
Normal file
@ -0,0 +1,170 @@
|
||||
#include "Debugger_Lists.h"
|
||||
#include <Windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include "DebuggerShared.h"
|
||||
|
||||
enum { TL_NAME, TL_PROGRAMCOUNTER, TL_ENTRYPOINT, TL_STATE, TL_COLUMNCOUNT };
|
||||
|
||||
char* threadColumns[] = {
|
||||
"Name", "PC", "Entry Point", "State"
|
||||
};
|
||||
|
||||
const float threadColumnSizes[] = {
|
||||
0.25f, 0.25f, 0.25f, 0.25f
|
||||
};
|
||||
|
||||
void CtrlThreadList::setDialogItem(HWND hwnd)
|
||||
{
|
||||
wnd = hwnd;
|
||||
|
||||
SetWindowLongPtr(wnd,GWLP_USERDATA,(LONG_PTR)this);
|
||||
oldProc = (WNDPROC) SetWindowLongPtr(wnd,GWLP_WNDPROC,(LONG_PTR)wndProc);
|
||||
|
||||
SendMessage(wnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
|
||||
|
||||
LVCOLUMN lvc;
|
||||
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
||||
lvc.iSubItem = 0;
|
||||
lvc.fmt = LVCFMT_LEFT;
|
||||
|
||||
RECT rect;
|
||||
GetWindowRect(wnd,&rect);
|
||||
|
||||
int totalListSize = (rect.right-rect.left-20);
|
||||
for (int i = 0; i < TL_COLUMNCOUNT; i++)
|
||||
{
|
||||
lvc.cx = threadColumnSizes[i] * totalListSize;
|
||||
lvc.pszText = threadColumns[i];
|
||||
ListView_InsertColumn(wnd, i, &lvc);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK CtrlThreadList::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CtrlThreadList* tl = (CtrlThreadList*) GetWindowLongPtr(hwnd,GWLP_USERDATA);
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_SIZE:
|
||||
{
|
||||
int width = LOWORD(lParam);
|
||||
RECT rect;
|
||||
GetWindowRect(hwnd,&rect);
|
||||
|
||||
int totalListSize = (rect.right-rect.left-20);
|
||||
for (int i = 0; i < TL_COLUMNCOUNT; i++)
|
||||
{
|
||||
ListView_SetColumnWidth(hwnd,i,threadColumnSizes[i] * totalListSize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB)
|
||||
{
|
||||
SendMessage(GetParent(hwnd),WM_DEB_TABPRESSED,0,0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case WM_GETDLGCODE:
|
||||
if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN)
|
||||
{
|
||||
if (wParam == VK_TAB) return DLGC_WANTMESSAGE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (LRESULT)CallWindowProc((WNDPROC)tl->oldProc,hwnd,msg,wParam,lParam);
|
||||
}
|
||||
|
||||
void CtrlThreadList::handleNotify(LPARAM lParam)
|
||||
{
|
||||
LPNMHDR mhdr = (LPNMHDR) lParam;
|
||||
|
||||
if (mhdr->code == NM_DBLCLK)
|
||||
{
|
||||
LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam;
|
||||
SendMessage(GetParent(wnd),WM_DEB_GOTOWPARAM,threads[item->iItem].curPC,0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mhdr->code == LVN_GETDISPINFO)
|
||||
{
|
||||
NMLVDISPINFO* dispInfo = (NMLVDISPINFO*)lParam;
|
||||
int index = dispInfo->item.iItem;
|
||||
|
||||
stringBuffer[0] = 0;
|
||||
switch (dispInfo->item.iSubItem)
|
||||
{
|
||||
case TL_NAME:
|
||||
strcpy(stringBuffer,threads[index].name);
|
||||
break;
|
||||
case TL_PROGRAMCOUNTER:
|
||||
sprintf(stringBuffer,"0x%08X",threads[index].curPC);
|
||||
break;
|
||||
case TL_ENTRYPOINT:
|
||||
sprintf(stringBuffer,"0x%08X",threads[index].entrypoint);
|
||||
break;
|
||||
case TL_STATE:
|
||||
switch (threads[index].status)
|
||||
{
|
||||
case THREADSTATUS_RUNNING:
|
||||
strcpy(stringBuffer,"Running");
|
||||
break;
|
||||
case THREADSTATUS_READY:
|
||||
strcpy(stringBuffer,"Ready");
|
||||
break;
|
||||
case THREADSTATUS_WAIT:
|
||||
strcpy(stringBuffer,"Waiting");
|
||||
break;
|
||||
case THREADSTATUS_SUSPEND:
|
||||
strcpy(stringBuffer,"Suspended");
|
||||
break;
|
||||
case THREADSTATUS_DORMANT:
|
||||
strcpy(stringBuffer,"Dormant");
|
||||
break;
|
||||
case THREADSTATUS_DEAD:
|
||||
strcpy(stringBuffer,"Dead");
|
||||
break;
|
||||
case THREADSTATUS_WAITSUSPEND:
|
||||
strcpy(stringBuffer,"Waiting/Suspended");
|
||||
break;
|
||||
default:
|
||||
strcpy(stringBuffer,"Invalid");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (stringBuffer[0] == 0) strcat(stringBuffer,"Invalid");
|
||||
dispInfo->item.pszText = stringBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
void CtrlThreadList::reloadThreads()
|
||||
{
|
||||
threads = GetThreadsInfo();
|
||||
|
||||
int items = ListView_GetItemCount(wnd);
|
||||
while (items < threads.size())
|
||||
{
|
||||
LVITEM lvI;
|
||||
lvI.pszText = LPSTR_TEXTCALLBACK; // Sends an LVN_GETDISPINFO message.
|
||||
lvI.mask = LVIF_TEXT | LVIF_IMAGE |LVIF_STATE;
|
||||
lvI.stateMask = 0;
|
||||
lvI.iSubItem = 0;
|
||||
lvI.state = 0;
|
||||
lvI.iItem = items;
|
||||
lvI.iImage = items;
|
||||
|
||||
ListView_InsertItem(wnd, &lvI);
|
||||
items++;
|
||||
}
|
||||
|
||||
while (items > threads.size())
|
||||
{
|
||||
ListView_DeleteItem(wnd,--items);
|
||||
}
|
||||
|
||||
InvalidateRect(wnd,NULL,true);
|
||||
UpdateWindow(wnd);
|
||||
}
|
18
Windows/Debugger/Debugger_Lists.h
Normal file
18
Windows/Debugger/Debugger_Lists.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../Core/Debugger/DebugInterface.h"
|
||||
#include "../../Core/HLE/sceKernelThread.h"
|
||||
|
||||
class CtrlThreadList
|
||||
{
|
||||
HWND wnd;
|
||||
WNDPROC oldProc;
|
||||
std::vector<DebugThreadInfo> threads;
|
||||
char stringBuffer[256];
|
||||
|
||||
public:
|
||||
void setDialogItem(HWND hwnd);
|
||||
void reloadThreads();
|
||||
void handleNotify(LPARAM lParam);
|
||||
static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
};
|
@ -266,6 +266,7 @@
|
||||
<ClCompile Include="Debugger\CtrlRegisterList.cpp" />
|
||||
<ClCompile Include="Debugger\DebuggerShared.cpp" />
|
||||
<ClCompile Include="Debugger\Debugger_Disasm.cpp" />
|
||||
<ClCompile Include="Debugger\Debugger_Lists.cpp" />
|
||||
<ClCompile Include="Debugger\Debugger_MemoryDlg.cpp" />
|
||||
<ClCompile Include="Debugger\Debugger_VFPUDlg.cpp" />
|
||||
<ClCompile Include="DinputDevice.cpp" />
|
||||
@ -306,6 +307,7 @@
|
||||
<ClInclude Include="Debugger\CtrlRegisterList.h" />
|
||||
<ClInclude Include="Debugger\DebuggerShared.h" />
|
||||
<ClInclude Include="Debugger\Debugger_Disasm.h" />
|
||||
<ClInclude Include="Debugger\Debugger_Lists.h" />
|
||||
<ClInclude Include="Debugger\Debugger_MemoryDlg.h" />
|
||||
<ClInclude Include="Debugger\Debugger_VFPUDlg.h" />
|
||||
<ClInclude Include="DinputDevice.h" />
|
||||
|
@ -107,6 +107,9 @@
|
||||
<ClCompile Include="Debugger\BreakpointWindow.cpp">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Debugger\Debugger_Lists.cpp">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Debugger\CtrlDisAsmView.h">
|
||||
@ -191,6 +194,9 @@
|
||||
<ClInclude Include="Debugger\BreakpointWindow.h">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Debugger\Debugger_Lists.h">
|
||||
<Filter>Windows\Debugger</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="icon1.ico">
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user