Skip to content

Commit

Permalink
Ignore BreakPoints added to debug dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
mvax committed Jun 10, 2022
1 parent 5630d6c commit 6cd36e3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
5 changes: 4 additions & 1 deletion src/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ INT_PTR CALLBACK CPUProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hwndDlg, IDC_DEBUG_BREAK_LIST, LB_SETCURSEL, (WPARAM)line, (LPARAM)0);
}

CheckDlgButton(hwndDlg, IDC_IGNORE_BREAKPOINTS, NES::IgnoreBreakPoints ? BST_CHECKED : BST_UNCHECKED);
DebugExt::InitDlg(hwndDlg);

return FALSE;
Expand Down Expand Up @@ -2053,7 +2054,9 @@ INT_PTR CALLBACK CPUProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDC_EXPAND_MACROS:
DebugExt::expand_macros = IsDlgButtonChecked(hwndDlg, IDC_EXPAND_MACROS) == BST_CHECKED;
return TRUE;

case IDC_IGNORE_BREAKPOINTS:
NES::IgnoreBreakPoints = IsDlgButtonChecked(hwndDlg, IDC_IGNORE_BREAKPOINTS) == BST_CHECKED;
return TRUE;
case IDC_DEBUG_BREAK_LIST:
if (wmEvent == LBN_DBLCLK)
{
Expand Down
32 changes: 19 additions & 13 deletions src/NES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ BOOL AutoRun;
BOOL FrameStep, GotStep;
BOOL HasMenu;
BOOL LoadedSRAMFromFile;
BOOL IgnoreBreakPoints;
Region CurRegion = REGION_NONE;

unsigned char PRG_ROM[MAX_PRGROM_SIZE][0x1000];
Expand Down Expand Up @@ -72,6 +73,7 @@ void Init (void)
DoStop = FALSE;
GameGenie = FALSE;
ROMLoaded = FALSE;
IgnoreBreakPoints = FALSE;
ZeroMemory(&RI, sizeof(RI));

UpdateTitlebar();
Expand Down Expand Up @@ -1030,20 +1032,24 @@ DWORD WINAPI Thread (void *param)
#endif /* ENABLE_DEBUGGER */
CPU::ExecOp();
#ifdef ENABLE_DEBUGGER
int i = Debugger::CheckForBreakPoint();
if (i) {
DoStop = TRUE;

// if debugger window is active tell it to highlight the first matching break
// as is matches by address only
if (Debugger::CPUWnd) {
SendMessage(Debugger::CPUWnd, WM_COMMAND, ID_BREAK_MARK_BREAKPOINT, 0);
} else {
SendMessage(hMainWnd, WM_COMMAND, ID_DEBUG_CPU_ON, 0);
if (!IgnoreBreakPoints)
{
int i = Debugger::CheckForBreakPoint();
if (i) {
DoStop = TRUE;

// if debugger window is active tell it to highlight the first matching break
// as is matches by address only
if (Debugger::CPUWnd) {
SendMessage(Debugger::CPUWnd, WM_COMMAND, ID_BREAK_MARK_BREAKPOINT, 0);
}
else {
SendMessage(hMainWnd, WM_COMMAND, ID_DEBUG_CPU_ON, 0);
}

if (i == 2)
EI.DbgOut(_T("Info: Debug breakpoint reached at PC = $%X"), CPU::PC);
}

if (i == 2)
EI.DbgOut(_T("Info: Debug breakpoint reached at PC = $%X"), CPU::PC);
}

if (Debugger::Enabled)
Expand Down
1 change: 1 addition & 0 deletions src/NES.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern BOOL AutoRun;
extern BOOL FrameStep, GotStep;
extern BOOL HasMenu;
extern BOOL LoadedSRAMFromFile;
extern BOOL IgnoreBreakPoints;

enum Region { REGION_NONE, REGION_NTSC, REGION_PAL, REGION_DENDY };
extern Region CurRegion;
Expand Down
9 changes: 5 additions & 4 deletions src/Nintendulator.rc
Original file line number Diff line number Diff line change
Expand Up @@ -945,19 +945,20 @@ BEGIN
CONTROL "PAL",IDC_DEBUG_MEM_PAL,"Button",BS_AUTORADIOBUTTON,376,80,48,8
LISTBOX IDC_DEBUG_MEM_LIST,220,92,194,76,LBS_NOREDRAW | LBS_HASSTRINGS | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_TABSTOP
SCROLLBAR IDC_DEBUG_MEM_SCROLL,414,102,10,66,SBS_VERT
GROUPBOX "Trace",IDC_STATIC,212,176,224,120
GROUPBOX "Trace",IDC_STATIC,212,176,224,116
LISTBOX IDC_DEBUG_TRACE_LIST,220,188,194,100,LBS_NOREDRAW | LBS_HASSTRINGS | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_TABSTOP
SCROLLBAR IDC_DEBUG_TRACE_SCROLL,414,188,10,100,SBS_VERT
LISTBOX IDC_DEBUG_SOURCECODE_LIST,4,312,630,256,LBS_HASSTRINGS | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
COMBOBOX IDC_DEBUG_SOURCEFILE,4,298,630,102,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_DEBUG_WATCH_LIST,443,32,183,64,LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_DEBUG_WATCH_EDIT,443,19,183,13,ES_AUTOHSCROLL
GROUPBOX "Watch",IDC_STATIC,438,4,196,98
GROUPBOX "Timers",IDC_STATIC,437,106,197,177
LISTBOX IDC_DEBUG_TIMER_LIST,443,116,184,160,LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
CONTROL "Expand macros",IDC_EXPAND_MACROS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,442,283,186,10
GROUPBOX "Timers",IDC_STATIC,437,106,197,157
LISTBOX IDC_DEBUG_TIMER_LIST,443,116,184,140,LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
CONTROL "Expand macros",IDC_EXPAND_MACROS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,443,266,186,10
DEFPUSHBUTTON "Set Memory Address:",IDC_DEBUG_CONT_SEEKTO,272,48,100,12
PUSHBUTTON "Seek to PC",IDC_DEBUG_CONT_SEEKPC,220,48,48,12
CONTROL "Ignore All Breakpoints",IDC_IGNORE_BREAKPOINTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,443,277,186,10
END

IDD_BREAKPOINT DIALOGEX 0, 0, 129, 230
Expand Down
8 changes: 5 additions & 3 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
#define IDC_PAL_PC10_COMPAT 1287
#define IDC_START_ADDR 1289
#define IDC_END_ADDR 1290
#define IDC_IGNORE_BREAKPOINTS 1290
#define IDC_DEBUG_SOURCECODE_LIST 5000
#define IDC_DEBUG_SOURCEFILE 5001
#define IDC_DEBUG_WATCH_LIST 5002
Expand Down Expand Up @@ -392,13 +393,14 @@
#define ID_PPU_MODE_DENDY 32826
#define ID_DEBUG_CPU_ON 32827
#define ID_DEBUGEXT_PAUSEON_MEM_WARNINGS 32832
#define ID_DEBUG_BREAK 32833
#define ID_DEBUGEXT_RNDMEMORY 35000
#define ID_DEBUGEXT_MEM_WARNINGS 35001
#define ID_DEBUGEXT_NTSC_ASPECT_RATIO 35002
#define ID_DEBUGEXT_PAL_ASPECT_RATIO 35003
#define ID_DEBUGEXT_MASK_SAFE_AREA 35004
#define ID_DEBUGEXT_NTSC_FILTER 35005
#define ID_BREAK_MARK_BREAKPOINT 35006
#define ID_BREAK_MARK_BREAKPOINT 35006
#define IDC_STATIC -1

// Next default values for new objects
Expand All @@ -407,8 +409,8 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 154
#define _APS_NEXT_COMMAND_VALUE 32833
#define _APS_NEXT_CONTROL_VALUE 1290
#define _APS_NEXT_COMMAND_VALUE 32834
#define _APS_NEXT_CONTROL_VALUE 1291
#define _APS_NEXT_SYMED_VALUE 107
#endif
#endif

0 comments on commit 6cd36e3

Please sign in to comment.