Merge pull request #2732 from Kingcom/Debugger

Highlight disabled breakpoints and use font sizes in more controls
This commit is contained in:
Henrik Rydgård 2013-07-10 02:16:26 -07:00
commit 1edce69608
6 changed files with 54 additions and 19 deletions

View file

@ -78,6 +78,14 @@ bool CBreakPoints::IsAddressBreakPoint(u32 addr)
return bp != INVALID_BREAKPOINT && breakPoints_[bp].enabled;
}
bool CBreakPoints::IsAddressBreakPoint(u32 addr, bool* enabled)
{
size_t bp = FindBreakpoint(addr);
if (bp == INVALID_BREAKPOINT) return false;
if (enabled != NULL) *enabled = breakPoints_[bp].enabled;
return true;
}
bool CBreakPoints::IsTempBreakPoint(u32 addr)
{
size_t bp = FindBreakpoint(addr, true, true);

View file

@ -100,6 +100,7 @@ public:
static const size_t INVALID_MEMCHECK = -1;
static bool IsAddressBreakPoint(u32 addr);
static bool IsAddressBreakPoint(u32 addr, bool* enabled);
static bool IsTempBreakPoint(u32 addr);
static void AddBreakPoint(u32 addr, bool temp = false);
static void RemoveBreakPoint(u32 addr);

View file

@ -354,11 +354,12 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
DeleteObject(backgroundPen);
// display address/symbol
if (debugger->isBreakpoint(address))
bool enabled;
if (CBreakPoints::IsAddressBreakPoint(address,&enabled))
{
textColor = 0x0000FF;
if (enabled) textColor = 0x0000FF;
int yOffset = max(-1,(rowHeight-14+1)/2);
DrawIconEx(hdc,2,rowY1+1+yOffset,breakPoint,32,32,0,0,DI_NORMAL);
DrawIconEx(hdc,2,rowY1+1+yOffset,enabled ? breakPoint : breakPointDisable,32,32,0,0,DI_NORMAL);
}
SetTextColor(hdc,textColor);
@ -613,6 +614,29 @@ void CtrlDisAsmView::redraw()
UpdateWindow(wnd);
}
void CtrlDisAsmView::toggleBreakpoint()
{
bool enabled;
if (CBreakPoints::IsAddressBreakPoint(curAddress,&enabled))
{
if (!enabled)
{
// enable disabled breakpoints
CBreakPoints::ChangeBreakPoint(curAddress,true);
} else if (CBreakPoints::GetBreakPointCondition(curAddress) != NULL)
{
// don't just delete a breakpoint with a custom condition
int ret = MessageBox(wnd,"This breakpoint has a custom condition.\nDo you want to remove it?","Confirmation",MB_YESNO);
if (ret != IDYES) return;
CBreakPoints::RemoveBreakPoint(curAddress);
} else {
// otherwise just remove breakpoint
CBreakPoints::RemoveBreakPoint(curAddress);
}
} else {
CBreakPoints::AddBreakPoint(curAddress);
}
}
void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
{
@ -624,7 +648,7 @@ void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
{
if (newAddress == curAddress && hasFocus)
{
debugger->toggleBreakpoint(curAddress);
toggleBreakpoint();
}
}
@ -650,7 +674,7 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
case ID_DISASM_ADDHLE:
break;
case ID_DISASM_TOGGLEBREAKPOINT:
debugger->toggleBreakpoint(curAddress);
toggleBreakpoint();
redraw();
break;
case ID_DISASM_COPYINSTRUCTIONDISASM:

View file

@ -128,11 +128,7 @@ public:
showHex=s;
}
void toggleBreakpoint()
{
debugger->toggleBreakpoint(curAddress);
redraw();
}
void toggleBreakpoint();
void scrollWindow(int lines)
{

View file

@ -5,6 +5,7 @@
#include "../../globals.h"
#include "Core/Config.h"
#include "../resource.h"
#include "../../Core/MemMap.h"
#include "../W32Util/Misc.h"
@ -24,14 +25,17 @@ CtrlMemView::CtrlMemView(HWND _wnd)
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG)this);
SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
SetScrollRange(wnd, SB_VERT, -1,1,TRUE);
rowHeight = g_Config.iFontHeight;
charWidth = g_Config.iFontWidth;
font =
CreateFont(12,8,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,
"Lucida Console");
CreateFont(rowHeight,charWidth,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"Lucida Console");
underlineFont =
CreateFont(12,8,0,0,FW_DONTCARE,FALSE,TRUE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,
"Lucida Console");
CreateFont(rowHeight,charWidth,0,0,FW_DONTCARE,FALSE,TRUE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"Lucida Console");
curAddress=0;
rowHeight=12;
mode=MV_NORMAL;
debugger = 0;
@ -41,7 +45,6 @@ CtrlMemView::CtrlMemView(HWND _wnd)
asciiSelected = false;
selectedNibble = 0;
charWidth = 8;
rowSize = 16;
addressStart = charWidth;
hexStart = addressStart + 9*charWidth;

View file

@ -11,6 +11,7 @@
#include "CtrlRegisterList.h"
#include "Debugger_MemoryDlg.h"
#include "Core/Config.h"
#include "../../globals.h"
#include "Debugger_Disasm.h"
#include "DebuggerShared.h"
@ -127,9 +128,11 @@ CtrlRegisterList::CtrlRegisterList(HWND _wnd)
SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)this);
//SetWindowLong(wnd, GWL_STYLE, GetWindowLong(wnd,GWL_STYLE) | WS_VSCROLL);
//SetScrollRange(wnd, SB_VERT, -1,1,TRUE);
font = CreateFont(12,0,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,
"Lucida Console");
rowHeight=12;
rowHeight=g_Config.iFontHeight;
font = CreateFont(rowHeight,g_Config.iFontWidth,0,0,FW_DONTCARE,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,DEFAULT_PITCH,"Lucida Console");
selecting=false;
selection=0;
category=0;