Ejemplo n.º 1
0
void
on_set_breakpoint_at_cursor_activate(GtkWidget *win)
{
	win_i *info = get_win_i(win, WIN_TYPE_ALL);
	DView *disasm = get_view(info, DVT_DISASSEMBLY);
	astring command;

	if (disasm->view->cursor_visible())
	{
		if (debug_cpu_get_visible_cpu(*info->machine) == disasm->view->source()->device())
		{
			offs_t address = downcast<debug_view_disasm *>(disasm->view)->selected_address();
			device_debug *cpuinfo = disasm->view->source()->device()->debug();
			device_debug::breakpoint *bp;
			INT32 bpindex = -1;

			/* first find an existing breakpoint at this address */
			for (bp = cpuinfo->breakpoint_first(); bp != NULL; bp = bp->next())
				if (address == bp->address())
				{
					bpindex = bp->index();
					break;
				}

			/* if it doesn't exist, add a new one */
			if (bpindex == -1)
				command.printf("bpset 0x%X", address);
			else
				command.printf("bpclear 0x%X", bpindex);
			debug_console_execute_command(*info->machine, command, 1);
		}
	}
}
Ejemplo n.º 2
0
static void debugmain_process_string(win_i *win, const char *str)
{
	if(!str[0])
		debug_cpu_get_visible_cpu(*win->machine)->debug()->single_step();
	else
		debug_console_execute_command(*win->machine, str, 1);
}
Ejemplo n.º 3
0
void MainWindow::executeCommand(bool withClear)
{
	QString command = m_inputEdit->text();

	// A blank command is a "silent step"
	if (command == "")
	{
		debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
		return;
	}

	// Send along the command
	debug_console_execute_command(*m_machine,
									command.toLocal8Bit().data(),
									true);

	// Add history & set the index to be the top of the stack
	addToHistory(command);

	// Clear out the text and reset the history pointer only if asked
	if (withClear)
	{
		m_inputEdit->clear();
		m_historyIndex = m_inputHistory.size();
	}

	// Refresh
	m_consoleView->viewport()->update();
	refreshAll();
}
Ejemplo n.º 4
0
static void debugmain_process_string(running_machine *machine, const char *str, void *dmp)
{
	if(!str[0])
		debug_cpu_single_step(machine, 1);
	else
		debug_console_execute_command(machine, str, 1);
}
Ejemplo n.º 5
0
void MainWindow::runToCursor(bool changedTo)
{
	debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
	if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device()))
	{
		offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address();
		std::string command = string_format("go 0x%X", address);
		debug_console_execute_command(*m_machine, command.c_str(), 1);
	}
}
Ejemplo n.º 6
0
void consolewin_info::process_string(char const *string)
{
	if (string[0] == 0) // an empty string is a single step
		debug_cpu_get_visible_cpu(machine())->debug()->single_step();
	else                // otherwise, just process the command
		debug_console_execute_command(machine(), string, 1);

	// clear the edit text box
	set_editwnd_text("");
}
Ejemplo n.º 7
0
void DasmWindow::runToCursor(bool changedTo)
{
	if (m_dasmView->view()->cursor_visible())
	{
		if (debug_cpu_get_visible_cpu(*m_machine) == m_dasmView->view()->source()->device())
		{
			offs_t address = downcast<debug_view_disasm*>(m_dasmView->view())->selected_address();
			astring command;
			command.printf("go 0x%X", address);
			debug_console_execute_command(*m_machine, command, 1);
		}
	}
}
Ejemplo n.º 8
0
void on_run_to_cursor_activate(GtkWidget *win)
{
	win_i *info = get_win_i(win, WIN_TYPE_ALL);
	DView *disasm = get_view(info, DVT_DISASSEMBLY);
	astring command;

	if (disasm->view->cursor_visible())
	{
		if (debug_cpu_get_visible_cpu(*info->machine) == disasm->view->source()->device())
		{
			offs_t address = downcast<debug_view_disasm *>(disasm->view)->selected_address();
			command.printf("go 0x%X", address);
			debug_console_execute_command(*info->machine, command, 1);
		}
	}
}
Ejemplo n.º 9
0
void DasmWindow::toggleBreakpointAtCursor(bool changedTo)
{
	if (m_dasmView->view()->cursor_visible())
	{
		if (debug_cpu_get_visible_cpu(*m_machine) == m_dasmView->view()->source()->device())
		{
			offs_t address = downcast<debug_view_disasm *>(m_dasmView->view())->selected_address();
			device_debug *cpuinfo = m_dasmView->view()->source()->device()->debug();

			// Find an existing breakpoint at this address
			INT32 bpindex = -1;
			for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
					bp != NULL;
					bp = bp->next())
			{
				if (address == bp->address())
				{
					bpindex = bp->index();
					break;
				}
			}

			// If none exists, add a new one
			astring command;
			if (bpindex == -1)
			{
				command.printf("bpset 0x%X", address);
			}
			else
			{
				command.printf("bpclear 0x%X", bpindex);
			}
			debug_console_execute_command(*m_machine, command, 1);
		}
	}

	refreshAll();
}
Ejemplo n.º 10
0
void MainWindow::enableBreakpointAtCursor(bool changedTo)
{
	debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
	if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device()))
	{
		offs_t const address = dasmView->selected_address();
		device_debug *const cpuinfo = dasmView->source()->device()->debug();

		// Find an existing breakpoint at this address
		device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
		while ((bp != NULL) && (bp->address() != address))
			bp = bp->next();

		if (bp != NULL)
		{
			INT32 const bpindex = bp->index();
			std::string command = string_format(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex);
			debug_console_execute_command(*m_machine, command.c_str(), 1);
		}
	}

	refreshAll();
}
Ejemplo n.º 11
0
bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
	disasmview_info *const dasmview = downcast<disasmview_info *>(m_views[0].get());

	switch (HIWORD(wparam))
	{
	// menu selections
	case 0:
		switch (LOWORD(wparam))
		{
		case ID_TOGGLE_BREAKPOINT:
			if (dasmview->cursor_visible())
			{
				offs_t const address = dasmview->selected_address();
				device_debug *const debug = dasmview->source_device()->debug();
				INT32 bpindex = -1;

				// first find an existing breakpoint at this address
				for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next())
				{
					if (address == bp->address())
					{
						bpindex = bp->index();
						break;
					}
				}

				// if it doesn't exist, add a new one
				if (!is_main_console())
				{
					if (bpindex == -1)
					{
						bpindex = debug->breakpoint_set(address, NULL, NULL);
						debug_console_printf(machine(), "Breakpoint %X set\n", bpindex);
					}
					else
					{
						debug->breakpoint_clear(bpindex);
						debug_console_printf(machine(), "Breakpoint %X cleared\n", bpindex);
					}
					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;

		case ID_DISABLE_BREAKPOINT:
			if (dasmview->cursor_visible())
			{
				offs_t const address = dasmview->selected_address();
				device_debug *const debug = dasmview->source_device()->debug();

				// first find an existing breakpoint at this address
				device_debug::breakpoint *bp = debug->breakpoint_first();
				while ((bp != NULL) && (bp->address() != address))
					bp = bp->next();

				// if it doesn't exist, add a new one
				if (bp != NULL)
				{
					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;

		case ID_RUN_TO_CURSOR:
			if (dasmview->cursor_visible())
			{
				offs_t const address = dasmview->selected_address();
				if (dasmview->source_is_visible_cpu())
				{
					astring command;
					command.printf("go 0x%X", address);
					debug_console_execute_command(machine(), command, 1);
				}
				else
				{
					dasmview->source_device()->debug()->go(address);
				}
			}
			return true;

		case ID_SHOW_RAW:
			dasmview->set_right_column(DASM_RIGHTCOL_RAW);
			recompute_children();
			return true;

		case ID_SHOW_ENCRYPTED:
			dasmview->set_right_column(DASM_RIGHTCOL_ENCRYPTED);
			recompute_children();
			return true;

		case ID_SHOW_COMMENTS:
			dasmview->set_right_column(DASM_RIGHTCOL_COMMENTS);
			recompute_children();
			return true;
		}
		break;
	}
	return editwin_info::handle_command(wparam, lparam);
}