2017-08-18 05:08:22 +00:00
|
|
|
#include "stdafx.h"
|
2022-09-21 05:16:07 +00:00
|
|
|
|
2017-08-18 05:08:22 +00:00
|
|
|
#include "DebuggerUI.h"
|
2017-08-30 04:54:06 +00:00
|
|
|
#include "Symbols.h"
|
2017-08-18 05:08:22 +00:00
|
|
|
|
|
|
|
CDebugStackView::CDebugStackView(CDebuggerUI * debugger) :
|
2018-12-09 04:26:11 +00:00
|
|
|
CDebugDialog<CDebugStackView>(debugger)
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CDebugStackView::~CDebugStackView(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-09-21 05:16:07 +00:00
|
|
|
LRESULT CDebugStackView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL & /*bHandled*/)
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2018-12-09 04:26:11 +00:00
|
|
|
DlgResize_Init(false, true);
|
2019-01-14 07:06:01 +00:00
|
|
|
DlgSavePos_Init(DebuggerUI_StackPos);
|
2019-01-13 08:13:59 +00:00
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
m_StackList.Attach(GetDlgItem(IDC_STACK_LIST));
|
|
|
|
m_StackList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);
|
2020-05-12 12:19:05 +00:00
|
|
|
m_StackList.AddColumn(L"#", 0);
|
|
|
|
m_StackList.AddColumn(L"00", 1);
|
|
|
|
m_StackList.AddColumn(L"04", 2);
|
|
|
|
m_StackList.AddColumn(L"08", 3);
|
|
|
|
m_StackList.AddColumn(L"0C", 4);
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
m_StackList.SetColumnWidth(0, 22);
|
|
|
|
m_StackList.SetColumnWidth(1, 64);
|
|
|
|
m_StackList.SetColumnWidth(2, 64);
|
|
|
|
m_StackList.SetColumnWidth(3, 64);
|
|
|
|
m_StackList.SetColumnWidth(4, 64);
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
m_SPStatic.Attach(GetDlgItem(IDC_SP_STATIC));
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2022-09-21 05:16:07 +00:00
|
|
|
LoadWindowPos();
|
|
|
|
WindowCreated();
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
return 0;
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2019-01-14 05:59:24 +00:00
|
|
|
void CDebugStackView::OnExitSizeMove(void)
|
|
|
|
{
|
2019-04-19 01:18:55 +00:00
|
|
|
SaveWindowPos(true);
|
2019-01-14 05:59:24 +00:00
|
|
|
}
|
|
|
|
|
2017-08-18 05:08:22 +00:00
|
|
|
LRESULT CDebugStackView::OnDestroy(void)
|
|
|
|
{
|
2017-09-13 12:00:53 +00:00
|
|
|
m_StackList.Detach();
|
|
|
|
m_SPStatic.Detach();
|
2018-12-09 04:26:11 +00:00
|
|
|
return 0;
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
2022-09-21 05:16:07 +00:00
|
|
|
LRESULT CDebugStackView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL & /*bHandled*/)
|
2017-08-18 05:08:22 +00:00
|
|
|
{
|
2018-12-09 04:26:11 +00:00
|
|
|
switch (wID)
|
|
|
|
{
|
|
|
|
case IDC_MEM_BTN:
|
2021-04-12 11:35:39 +00:00
|
|
|
if (g_Reg != nullptr)
|
2018-12-09 04:26:11 +00:00
|
|
|
{
|
|
|
|
m_Debugger->Debug_ShowMemoryLocation(g_Reg->m_GPR[29].UW[0], true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
2017-08-18 05:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDebugStackView::Refresh()
|
|
|
|
{
|
2021-04-12 11:35:39 +00:00
|
|
|
if (g_Reg == nullptr)
|
2019-01-27 22:40:23 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
m_StackList.SetRedraw(FALSE);
|
|
|
|
m_StackList.DeleteAllItems();
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2019-01-27 22:40:23 +00:00
|
|
|
uint32_t spBase = g_Reg->m_GPR[29].UW[0];
|
2020-05-12 12:19:05 +00:00
|
|
|
m_SPStatic.SetWindowText(stdstr_f("SP: %08X", spBase).ToUTF16().c_str());
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
for (int i = 0; i < 0x10; i++)
|
|
|
|
{
|
2020-05-12 12:19:05 +00:00
|
|
|
wchar_t t[4];
|
2021-01-19 05:58:59 +00:00
|
|
|
swprintf(t, sizeof(t) / sizeof(t[0]), L"%02X", i * 0x10);
|
2018-12-09 04:26:11 +00:00
|
|
|
m_StackList.AddItem(i, 0, t);
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
for (int j = 0; j < 4; j++)
|
|
|
|
{
|
|
|
|
uint32_t vaddr = spBase + (i * 0x10) + (j * 4);
|
|
|
|
uint32_t val;
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2019-12-25 00:41:20 +00:00
|
|
|
if (!m_Debugger->DebugLoad_VAddr(vaddr, val))
|
2018-12-09 04:26:11 +00:00
|
|
|
{
|
2020-05-12 12:19:05 +00:00
|
|
|
m_StackList.AddItem(i, j + 1, L"????????");
|
2018-12-09 04:26:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2020-05-12 12:19:05 +00:00
|
|
|
wchar_t valStr[9];
|
|
|
|
wsprintf(valStr, L"%08X", val);
|
2018-12-09 04:26:11 +00:00
|
|
|
m_StackList.AddItem(i, j + 1, valStr);
|
|
|
|
}
|
|
|
|
}
|
2017-08-18 05:08:22 +00:00
|
|
|
|
2018-12-09 04:26:11 +00:00
|
|
|
m_StackList.SetRedraw(TRUE);
|
2021-03-18 03:34:33 +00:00
|
|
|
}
|