Merge pull request #141 from cuavas/master

Fix debug builds, make debuggers a bit more consistent
This commit is contained in:
Miodrag Milanović 2015-02-21 12:56:48 +01:00
commit 90f9f1e0c7
4 changed files with 25 additions and 23 deletions

View File

@ -774,10 +774,10 @@ LRESULT CALLBACK debugview_info::static_view_proc(HWND wnd, UINT message, WPARAM
}
debugview_info *const info = (debugview_info *)(FPTR)GetWindowLongPtr(wnd, GWLP_USERDATA);
if (!info)
if (info == NULL)
return DefWindowProc(wnd, message, wparam, lparam);
assert(info->m_wnd == wnd);
assert((info->m_wnd == wnd) || (info->m_wnd == NULL));
return info->view_proc(message, wparam, lparam);
}

View File

@ -564,10 +564,10 @@ LRESULT CALLBACK debugwin_info::static_window_proc(HWND wnd, UINT message, WPARA
}
debugwin_info *const info = (debugwin_info *)(FPTR)GetWindowLongPtr(wnd, GWLP_USERDATA);
if (!info)
if (info == NULL)
return DefWindowProc(wnd, message, wparam, lparam);
assert(info->m_wnd == wnd);
assert((info->m_wnd == wnd) || (info->m_wnd == NULL));
return info->window_proc(message, wparam, lparam);
}

View File

@ -21,7 +21,7 @@ class debugwin_info : protected debugbase_info
public:
template<class U> friend class simple_list;
debugwin_info(debugger_windows_interface &debugger, bool main_console, LPCSTR title, WNDPROC handler);
debugwin_info(debugger_windows_interface &debugger, bool is_main_console, LPCSTR title, WNDPROC handler);
virtual ~debugwin_info();
bool is_valid() const { return m_wnd != NULL; }
@ -101,6 +101,7 @@ protected:
ID_DEVICE_OPTIONS // always keep this at the end
};
bool is_main_console() const { return m_is_main_console; }
HWND window() const { return m_wnd; }
UINT32 minwidth() const { return m_minwidth; }
UINT32 maxwidth() const { return m_maxwidth; }

View File

@ -131,7 +131,8 @@ void disasmbasewin_info::update_menu()
else
ModifyMenu(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND, ID_DISABLE_BREAKPOINT, TEXT("Enable breakpoint at cursor\tShift+F9"));
}
EnableMenuItem(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND | (bp != NULL ? MF_ENABLED : MF_GRAYED));
bool const available = (bp != NULL) && (!is_main_console() || dasmview->source_is_visible_cpu());
EnableMenuItem(menu, ID_DISABLE_BREAKPOINT, MF_BYCOMMAND | (available ? MF_ENABLED : MF_GRAYED));
}
else
{
@ -177,16 +178,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
}
// if it doesn't exist, add a new one
if (dasmview->source_is_visible_cpu())
{
astring command;
if (bpindex == -1)
command.printf("bpset 0x%X", address);
else
command.printf("bpclear 0x%X", bpindex);
debug_console_execute_command(machine(), command, 1);
}
else
if (!is_main_console())
{
if (bpindex == -1)
{
@ -201,6 +193,15 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
machine().debug_view().update_all();
debugger_refresh_display(machine());
}
else if (dasmview->source_is_visible_cpu())
{
astring command;
if (bpindex == -1)
command.printf("bpset 0x%X", address);
else
command.printf("bpclear 0x%X", bpindex);
debug_console_execute_command(machine(), command, 1);
}
}
return true;
@ -218,19 +219,19 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
// if it doesn't exist, add a new one
if (bp != NULL)
{
if (dasmview->source_is_visible_cpu())
{
astring command;
command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index());
debug_console_execute_command(machine(), command, 1);
}
else
if (!is_main_console())
{
debug->breakpoint_enable(bp->index(), !bp->enabled());
debug_console_printf(machine(), "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled");
machine().debug_view().update_all();
debugger_refresh_display(machine());
}
else if (dasmview->source_is_visible_cpu())
{
astring command;
command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index());
debug_console_execute_command(machine(), command, 1);
}
}
}
return true;