Merge pull request #4210 from Kingcom/Debugger

Highlight branch arrows that reference the current opcode
This commit is contained in:
Henrik Rydgård 2013-10-17 02:58:01 -07:00
commit 1e6aa83bb6

View file

@ -484,6 +484,7 @@ void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText)
void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line) void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line)
{ {
HPEN pen;
u32 windowEnd = windowStart+(visibleRows+2)*instructionSize; u32 windowEnd = windowStart+(visibleRows+2)*instructionSize;
int topY; int topY;
@ -515,7 +516,17 @@ void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line)
return; return;
} }
// highlight line in a different color if it affects the currently selected opcode
if (line.first == curAddress || line.second == curAddress)
{
pen = CreatePen(0,0,0x257AFA);
} else {
pen = CreatePen(0,0,0xFF3020);
}
HPEN oldPen = (HPEN) SelectObject(hdc,pen);
int x = pixelPositions.arrowsStart+line.laneIndex*8; int x = pixelPositions.arrowsStart+line.laneIndex*8;
if (topY < 0) // first is not visible, but second is if (topY < 0) // first is not visible, but second is
{ {
MoveToEx(hdc,x-2,bottomY,0); MoveToEx(hdc,x-2,bottomY,0);
@ -562,6 +573,9 @@ void CtrlDisAsmView::drawBranchLine(HDC hdc, BranchLine& line)
LineTo(hdc,x+1,bottomY+5); LineTo(hdc,x+1,bottomY+5);
} }
} }
SelectObject(hdc,oldPen);
DeleteObject(pen);
} }
void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam) void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
@ -577,7 +591,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
SetBkMode(hdc, TRANSPARENT); SetBkMode(hdc, TRANSPARENT);
HPEN nullPen=CreatePen(0,0,0xffffff); HPEN nullPen=CreatePen(0,0,0xffffff);
HPEN condPen=CreatePen(0,0,0xFF3020);
HBRUSH nullBrush=CreateSolidBrush(0xffffff); HBRUSH nullBrush=CreateSolidBrush(0xffffff);
HBRUSH currentBrush=CreateSolidBrush(0xFFEfE8); HBRUSH currentBrush=CreateSolidBrush(0xFFEfE8);
@ -665,7 +678,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
SelectObject(hdc,font); SelectObject(hdc,font);
} }
SelectObject(hdc,condPen);
for (size_t i = 0; i < visibleFunctionAddresses.size(); i++) for (size_t i = 0; i < visibleFunctionAddresses.size(); i++)
{ {
auto it = functions.find(visibleFunctionAddresses[i]); auto it = functions.find(visibleFunctionAddresses[i]);
@ -693,7 +705,6 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
DeleteDC(hdc); DeleteDC(hdc);
DeleteObject(nullPen); DeleteObject(nullPen);
DeleteObject(condPen);
DeleteObject(nullBrush); DeleteObject(nullBrush);
DeleteObject(currentBrush); DeleteObject(currentBrush);