Merge pull request #2556 from Kingcom/master

Memory view in disassembler
This commit is contained in:
Henrik Rydgård committed 2013-06-30 08:45:30 -07:00
commit 7df69decb6
10 files changed
+79 -23

No files matched your search

+1
View File
@@ -1013,6 +1013,7 @@ if(WIN32)
Windows/Debugger/CtrlRegisterList.cpp
Windows/Debugger/CtrlRegisterList.h
Windows/Debugger/Debugger.h
Windows/Debugger/DebuggerShared.h
Windows/Debugger/Debugger_Disasm.cpp
Windows/Debugger/Debugger_Disasm.h
Windows/Debugger/Debugger_MemoryDlg.cpp
+3 -2
View File
@@ -10,6 +10,7 @@
#include "CtrlDisAsmView.h"
#include "Debugger_MemoryDlg.h"
#include "ExpressionParser.h"
#include "DebuggerShared.h"
#include "../../Core/Debugger/SymbolMap.h"
#include "../../globals.h"
#include "../main.h"
@@ -562,7 +563,7 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
case VK_F9:
if (debugger->GetPC() != curAddress)
{
SendMessage(GetParent(wnd),WM_USER+3,curAddress,0);
SendMessage(GetParent(wnd),WM_DEB_RUNTOWPARAM,curAddress,0);
}
break;
case VK_F10:
@@ -692,7 +693,7 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
{
symbolMap.SetSymbolName(sym,newname);
redraw();
SendMessage(GetParent(wnd),WM_USER+1,0,0);
SendMessage(GetParent(wnd),WM_DEB_MAPLOADED,0,0);
}
}
else
+6 -3
View File
@@ -13,7 +13,7 @@
#include "Debugger_Disasm.h"
#include "ExpressionParser.h"
#include "DebuggerShared.h"
#include "CtrlMemView.h"
TCHAR CtrlMemView::szClassName[] = _T("CtrlMemView");
@@ -143,7 +143,7 @@ LRESULT CALLBACK CtrlMemView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
ccp->redraw();
break;
case WM_GETDLGCODE: // we want to process the arrow keys and all characters ourselves
return DLGC_WANTARROWS|DLGC_WANTCHARS;
return DLGC_WANTARROWS|DLGC_WANTCHARS|DLGC_WANTTAB;
break;
default:
break;
@@ -377,6 +377,9 @@ void CtrlMemView::onKeyDown(WPARAM wParam, LPARAM lParam)
case VK_CONTROL:
ctrlDown = true;
break;
case VK_TAB:
SendMessage(GetParent(wnd),WM_DEB_TABPRESSED,0,0);
break;
default:
return;
}
@@ -384,7 +387,7 @@ void CtrlMemView::onKeyDown(WPARAM wParam, LPARAM lParam)
void CtrlMemView::onChar(WPARAM wParam, LPARAM lParam)
{
if (ctrlDown) return;
if (ctrlDown || wParam == VK_TAB) return;
if (!Memory::IsValidAddress(curAddress))
{
+10
View File
@@ -0,0 +1,10 @@
#pragma once
#include <Windows.h>
enum { WM_DEB_RUNTOWPARAM = WM_USER+2,
WM_DEB_GOTOBREAKPOINT,
WM_DEB_REMOVEBREAKPOINT,
WM_DEB_GOTOADDRESSEDIT,
WM_DEB_MAPLOADED,
WM_DEB_TABPRESSED
};
+51 -15
View File
@@ -11,9 +11,11 @@
#include "Debugger_Disasm.h"
#include "Debugger_VFPUDlg.h"
#include "ExpressionParser.h"
#include "DebuggerShared.h"
#include "../main.h"
#include "CtrlRegisterList.h"
#include "CtrlMemView.h"
#include "../../Core/Core.h"
#include "../../Core/CPU.h"
@@ -53,19 +55,28 @@ static LRESULT CALLBACK BreakpointListProc(HWND hDlg, UINT message, WPARAM wPara
if(wParam == VK_RETURN)
{
int index = ListView_GetSelectionMark(hDlg);
SendMessage(GetParent(hDlg),WM_USER+4,index,0);
SendMessage(GetParent(hDlg),WM_DEB_GOTOBREAKPOINT,index,0);
return 0;
} else if (wParam == VK_DELETE)
{
int index = ListView_GetSelectionMark(hDlg);
SendMessage(GetParent(hDlg),WM_USER+5,index,0);
SendMessage(GetParent(hDlg),WM_DEB_REMOVEBREAKPOINT,index,0);
return 0;
} else if (wParam == VK_TAB)
{
SendMessage(GetParent(hDlg),WM_DEB_TABPRESSED,0,0);
return 0;
}
default:
return (LRESULT)CallWindowProc((WNDPROC)DefBreakpointListProc,hDlg,message,wParam,lParam);
break;
case WM_GETDLGCODE:
if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN)
{
if (wParam == VK_TAB) return DLGC_WANTMESSAGE;
}
break;
};
return 0;
return (LRESULT)CallWindowProc((WNDPROC)DefBreakpointListProc,hDlg,message,wParam,lParam);;
}
@@ -79,7 +90,7 @@ LRESULT CALLBACK GotoEditProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
case WM_KEYDOWN:
if( wParam == VK_RETURN )
{
SendMessage(GetParent(hDlg),WM_USER+6,0,0);
SendMessage(GetParent(hDlg),WM_DEB_GOTOADDRESSEDIT,0,0);
return 0;
}
break;
@@ -178,6 +189,14 @@ CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Di
ListView_InsertColumn(breakpointHwnd, i, &lvc);
}
// init memory viewer
CtrlMemView *mem = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW));
mem->setDebugger(_cpu);
// init memory/breakpoint "tab"
ShowWindow(GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST), SW_NORMAL);
ShowWindow(GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW), SW_HIDE);
// Actually resize the window to the proper size (after the above setup.)
if (w != -1 && h != -1)
{
@@ -713,10 +732,10 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
}
case WM_USER+1:
case WM_DEB_MAPLOADED:
NotifyMapLoaded();
break;
case WM_USER+3: // run to wparam
case WM_DEB_RUNTOWPARAM:
{
lastTicks = CoreTiming::GetTicks();
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
@@ -727,13 +746,13 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
Core_EnableStepping(false);
break;
}
case WM_USER+4:
case WM_DEB_GOTOBREAKPOINT:
gotoBreakpointAddress(wParam);
break;
case WM_USER+5:
case WM_DEB_REMOVEBREAKPOINT:
removeBreakpoint(wParam);
break;
case WM_USER+6: // goto edit
case WM_DEB_GOTOADDRESSEDIT:
{
char szBuffer[256];
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
@@ -754,7 +773,23 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
case WM_DISASM_SETDEBUG:
SetDebugMode(lParam != 0);
return TRUE;
case WM_DEB_TABPRESSED:
{
HWND bp = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST);
HWND mem = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW);
if (IsWindowVisible(bp))
{
ShowWindow(bp,SW_HIDE);
ShowWindow(mem,SW_NORMAL);
SetFocus(mem);
} else {
ShowWindow(bp,SW_NORMAL);
ShowWindow(mem,SW_HIDE);
SetFocus(bp);
}
}
break;
case WM_SIZE:
{
UpdateSize(LOWORD(lParam), HIWORD(lParam));
@@ -765,7 +800,6 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOVE:
SavePosition();
break;
case WM_GETMINMAXINFO:
{
MINMAXINFO *m = (MINMAXINFO *)lParam;
@@ -788,7 +822,8 @@ void CDisasm::UpdateSize(WORD width, WORD height)
HWND funclist = GetDlgItem(m_hDlg, IDC_FUNCTIONLIST);
HWND regList = GetDlgItem(m_hDlg, IDC_REGLIST);
HWND breakpointList = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST);
HWND memView = GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW);
int defaultHeight = defaultRect.bottom - defaultRect.top;
int breakpointHeight = defaultBreakpointRect.bottom - defaultBreakpointRect.top;
if (height < defaultHeight)
@@ -804,7 +839,8 @@ void CDisasm::UpdateSize(WORD width, WORD height)
MoveWindow(funclist, 8, regTop, regWidth, height-regTop-breakpointHeight-12, TRUE);
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);
GetWindowRect(GetDlgItem(m_hDlg, IDC_REGLIST),&regRect);
GetWindowRect(GetDlgItem(m_hDlg, IDC_DISASMVIEW),&disRect);
GetWindowRect(GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST),&breakpointRect);
+4 -3
View File
@@ -9,6 +9,7 @@
#include "CtrlMemView.h"
#include "ExpressionParser.h"
#include "DebuggerShared.h"
#include "../../Core/MIPS/MIPSDebugInterface.h" // BAD
@@ -24,7 +25,7 @@ LRESULT CALLBACK AddressEditProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
case WM_KEYDOWN:
if( wParam == VK_RETURN )
{
SendMessage(AddressEditParentHwnd,WM_USER+2,0,0);
SendMessage(AddressEditParentHwnd,WM_DEB_GOTOADDRESSEDIT,0,0);
return 0;
}
case WM_KEYUP:
@@ -158,10 +159,10 @@ BOOL CMemoryDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
}
}
break;
case WM_USER+1:
case WM_DEB_MAPLOADED:
NotifyMapLoaded();
break;
case WM_USER+2: // enter hit on address edit
case WM_DEB_GOTOADDRESSEDIT:
{
CtrlMemView *mv = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_MEMVIEW));
char temp[256];
+1
View File
@@ -302,6 +302,7 @@
<ClInclude Include="Debugger\CtrlDisAsmView.h" />
<ClInclude Include="Debugger\CtrlMemView.h" />
<ClInclude Include="Debugger\CtrlRegisterList.h" />
<ClInclude Include="Debugger\DebuggerShared.h" />
<ClInclude Include="Debugger\Debugger_Disasm.h" />
<ClInclude Include="Debugger\Debugger_MemoryDlg.h" />
<ClInclude Include="Debugger\Debugger_VFPUDlg.h" />
+3
View File
@@ -185,6 +185,9 @@
<ClInclude Include="Debugger\ExpressionParser.h">
<Filter>Windows\Debugger</Filter>
</ClInclude>
<ClInclude Include="Debugger\DebuggerShared.h">
<Filter>Windows\Debugger</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="icon1.ico">
BIN
View File
Binary file not shown.
Binary file not shown.