trunk/src/osd/sdl/debugqtmemorywindow.c
| r22724 | r22725 | |
| 35 | 35 | connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int))); |
| 36 | 36 | |
| 37 | 37 | // The main memory window |
| 38 | | m_memTable = new DebuggerView(DVT_MEMORY, |
| 39 | | m_machine, |
| 40 | | this); |
| 38 | m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this); |
| 41 | 39 | |
| 42 | 40 | // Layout |
| 43 | 41 | QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame); |
| r22724 | r22725 | |
| 265 | 263 | |
| 266 | 264 | |
| 267 | 265 | //========================================================================= |
| 266 | // DebuggerMemView |
| 267 | //========================================================================= |
| 268 | void DebuggerMemView::mousePressEvent(QMouseEvent* event) |
| 269 | { |
| 270 | const bool leftClick = event->button() == Qt::LeftButton; |
| 271 | const bool rightClick = event->button() == Qt::RightButton; |
| 272 | |
| 273 | if (leftClick || rightClick) |
| 274 | { |
| 275 | QFontMetrics actualFont = fontMetrics(); |
| 276 | const int fontWidth = MAX(1, actualFont.width('_')); |
| 277 | const int fontHeight = MAX(1, actualFont.height()); |
| 278 | |
| 279 | debug_view_xy topLeft = view()->visible_position(); |
| 280 | debug_view_xy clickViewPosition; |
| 281 | clickViewPosition.x = topLeft.x + (event->x() / fontWidth); |
| 282 | clickViewPosition.y = topLeft.y + (event->y() / fontHeight); |
| 283 | if (leftClick) |
| 284 | { |
| 285 | view()->process_click(DCK_LEFT_CLICK, clickViewPosition); |
| 286 | } |
| 287 | else if (rightClick) |
| 288 | { |
| 289 | // Display the last known PC to write to this memory location & copy it onto the clipboard |
| 290 | debug_view_memory* memView = downcast<debug_view_memory*>(view()); |
| 291 | const offs_t address = memView->addressAtCursorPosition(clickViewPosition); |
| 292 | const debug_view_memory_source* source = downcast<const debug_view_memory_source*>(memView->source()); |
| 293 | address_space* addressSpace = source->space(); |
| 294 | const int nativeDataWidth = addressSpace->data_width() / 8; |
| 295 | const UINT64 memValue = debug_read_memory(*addressSpace, |
| 296 | addressSpace->address_to_byte(address), |
| 297 | nativeDataWidth, |
| 298 | true); |
| 299 | const offs_t pc = source->device()->debug()->track_mem_pc_from_space_address_data(addressSpace->spacenum(), |
| 300 | address, |
| 301 | memValue); |
| 302 | if (pc != (offs_t)(-1)) |
| 303 | { |
| 304 | // TODO: You can specify a box that the tooltip stays alive within - might be good? |
| 305 | const QString addressAndPc = QString("Address %1 written at PC=%2").arg(address, 2, 16).arg(pc, 2, 16); |
| 306 | QToolTip::showText(QCursor::pos(), addressAndPc, NULL); |
| 307 | |
| 308 | // Copy the PC into the clipboard as well |
| 309 | QClipboard *clipboard = QApplication::clipboard(); |
| 310 | clipboard->setText(QString("%1").arg(pc, 2, 16)); |
| 311 | } |
| 312 | else |
| 313 | { |
| 314 | QToolTip::showText(QCursor::pos(), "UNKNOWN PC", NULL); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | viewport()->update(); |
| 319 | update(); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | |
| 324 | //========================================================================= |
| 268 | 325 | // MemoryWindowQtConfig |
| 269 | 326 | //========================================================================= |
| 270 | 327 | void MemoryWindowQtConfig::buildFromQWidget(QWidget* widget) |
trunk/src/emu/debug/dvmemory.c
| r22724 | r22725 | |
| 204 | 204 | if (type == VIEW_NOTIFY_CURSOR_CHANGED) |
| 205 | 205 | { |
| 206 | 206 | // normalize the cursor |
| 207 | | set_cursor_pos(get_cursor_pos()); |
| 207 | set_cursor_pos(get_cursor_pos(m_cursor)); |
| 208 | 208 | } |
| 209 | 209 | else if (type == VIEW_NOTIFY_SOURCE_CHANGED) |
| 210 | 210 | { |
| r22724 | r22725 | |
| 315 | 315 | void debug_view_memory::view_char(int chval) |
| 316 | 316 | { |
| 317 | 317 | // get the position |
| 318 | | cursor_pos pos = get_cursor_pos(); |
| 318 | cursor_pos pos = get_cursor_pos(m_cursor); |
| 319 | 319 | |
| 320 | 320 | // handle the incoming key |
| 321 | 321 | switch (chval) |
| r22724 | r22725 | |
| 437 | 437 | |
| 438 | 438 | /* cursor popup|toggle */ |
| 439 | 439 | bool cursorVisible = true; |
| 440 | | if (m_cursor.y == origcursor.y) |
| 440 | if (m_cursor.y == origcursor.y && m_cursor.x == origcursor.x) |
| 441 | 441 | { |
| 442 | 442 | cursorVisible = !m_cursor_visible; |
| 443 | 443 | } |
| r22724 | r22725 | |
| 461 | 461 | const debug_view_memory_source &source = downcast<const debug_view_memory_source &>(*m_source); |
| 462 | 462 | |
| 463 | 463 | // get the current cursor position |
| 464 | | cursor_pos pos = get_cursor_pos(); |
| 464 | cursor_pos pos = get_cursor_pos(m_cursor); |
| 465 | 465 | |
| 466 | 466 | // determine the maximum address and address format string from the raw information |
| 467 | 467 | int addrchars; |
| r22724 | r22725 | |
| 565 | 565 | // an address and a shift value |
| 566 | 566 | //------------------------------------------------- |
| 567 | 567 | |
| 568 | | debug_view_memory::cursor_pos debug_view_memory::get_cursor_pos() |
| 568 | debug_view_memory::cursor_pos debug_view_memory::get_cursor_pos(const debug_view_xy& cursor) |
| 569 | 569 | { |
| 570 | 570 | // start with the base address for this row |
| 571 | 571 | cursor_pos pos; |
| 572 | | pos.m_address = m_byte_offset + m_cursor.y * m_bytes_per_chunk * m_chunks_per_row; |
| 572 | pos.m_address = m_byte_offset + cursor.y * m_bytes_per_chunk * m_chunks_per_row; |
| 573 | 573 | |
| 574 | 574 | // determine the X position within the middle section, clamping as necessary |
| 575 | 575 | const memory_view_pos &posdata = s_memory_pos_table[m_bytes_per_chunk]; |
| 576 | | int xposition = m_cursor.x - m_section[1].m_pos - 1; |
| 576 | int xposition = cursor.x - m_section[1].m_pos - 1; |
| 577 | 577 | if (xposition < 0) |
| 578 | 578 | xposition = 0; |
| 579 | 579 | else if (xposition >= posdata.m_spacing * m_chunks_per_row) |
trunk/src/emu/debug/debugcpu.h
| r22724 | r22725 | |
| 156 | 156 | // internals |
| 157 | 157 | bool hit(); |
| 158 | 158 | |
| 159 | | registerpoint * m_next; // next in the list |
| 159 | registerpoint * m_next; // next in the list |
| 160 | 160 | int m_index; // user reported index |
| 161 | 161 | UINT8 m_enabled; // enabled? |
| 162 | 162 | parsed_expression m_condition; // condition |
| r22724 | r22725 | |
| 258 | 258 | void set_track_pc_visited(const offs_t& pc); |
| 259 | 259 | void track_pc_data_clear() { m_track_pc_set.clear(); } |
| 260 | 260 | |
| 261 | // memory tracking |
| 262 | void set_track_mem(bool value) { m_track_mem = value; } |
| 263 | offs_t track_mem_pc_from_space_address_data(const address_spacenum& space, |
| 264 | const offs_t& address, |
| 265 | const UINT64& data) const; |
| 266 | void track_mem_data_clear() { m_track_mem_set.clear(); } |
| 267 | |
| 261 | 268 | // tracing |
| 262 | 269 | void trace(FILE *file, bool trace_over, const char *action); |
| 263 | 270 | void trace_printf(const char *fmt, ...); |
| r22724 | r22725 | |
| 298 | 305 | device_disasm_interface * m_disasm; // disasm interface, if present |
| 299 | 306 | |
| 300 | 307 | // global state |
| 301 | | UINT32 m_flags; // debugging flags for this CPU |
| 302 | | symbol_table m_symtable; // symbol table for expression evaluation |
| 308 | UINT32 m_flags; // debugging flags for this CPU |
| 309 | symbol_table m_symtable; // symbol table for expression evaluation |
| 303 | 310 | debug_instruction_hook_func m_instrhook; // per-instruction callback hook |
| 304 | 311 | |
| 305 | 312 | // disassembly |
| r22724 | r22725 | |
| 377 | 384 | bool operator < (const dasm_pc_tag& rhs) const |
| 378 | 385 | { |
| 379 | 386 | if (m_address == rhs.m_address) |
| 380 | | return m_crc < rhs.m_crc; |
| 387 | return m_crc < rhs.m_crc; |
| 381 | 388 | return (m_address < rhs.m_address); |
| 382 | 389 | } |
| 383 | 390 | |
| 384 | | offs_t m_address; |
| 391 | offs_t m_address; // Stores [nothing] for a given address & crc32 |
| 385 | 392 | UINT32 m_crc; |
| 386 | 393 | }; |
| 387 | 394 | simple_set<dasm_pc_tag> m_track_pc_set; |
| r22724 | r22725 | |
| 393 | 400 | public: |
| 394 | 401 | dasm_comment(offs_t address, UINT32 crc, const char *text, rgb_t color); |
| 395 | 402 | |
| 396 | | astring m_text; // comment text |
| 397 | | rgb_t m_color; // comment color |
| 403 | astring m_text; // Stores comment text & color for a given address & crc32 |
| 404 | rgb_t m_color; |
| 398 | 405 | }; |
| 399 | 406 | simple_set<dasm_comment> m_comment_set; // collection of comments |
| 400 | 407 | UINT32 m_comment_change; // change counter for comments |
| 401 | 408 | |
| 409 | // memory tracking |
| 410 | class dasm_memory_access |
| 411 | { |
| 412 | public: |
| 413 | dasm_memory_access(const address_spacenum& address_space, |
| 414 | const offs_t& address, |
| 415 | const UINT64& data, |
| 416 | const offs_t& pc); |
| 417 | |
| 418 | // required to be included in a simple_set |
| 419 | bool operator < (const dasm_memory_access& rhs) const |
| 420 | { |
| 421 | if ((m_address == rhs.m_address) && (m_address_space == rhs.m_address_space)) |
| 422 | return m_data < rhs.m_data; |
| 423 | return (m_address < rhs.m_address) && (m_address_space == rhs.m_address_space); |
| 424 | } |
| 425 | |
| 426 | // Stores the PC for a given address, memory region, and data value |
| 427 | address_spacenum m_address_space; |
| 428 | offs_t m_address; |
| 429 | UINT64 m_data; |
| 430 | offs_t m_pc; |
| 431 | }; |
| 432 | simple_set<dasm_memory_access> m_track_mem_set; |
| 433 | bool m_track_mem; |
| 434 | |
| 402 | 435 | // internal flag values |
| 403 | 436 | static const UINT32 DEBUG_FLAG_OBSERVING = 0x00000001; // observing this CPU |
| 404 | 437 | static const UINT32 DEBUG_FLAG_HISTORY = 0x00000002; // tracking this CPU's history |
trunk/src/emu/debug/debugcmd.c
| r22724 | r22725 | |
| 143 | 143 | static void execute_traceflush(running_machine &machine, int ref, int params, const char **param); |
| 144 | 144 | static void execute_history(running_machine &machine, int ref, int params, const char **param); |
| 145 | 145 | static void execute_trackpc(running_machine &machine, int ref, int params, const char **param); |
| 146 | static void execute_trackmem(running_machine &machine, int ref, int params, const char **param); |
| 147 | static void execute_pcatmem(running_machine &machine, int ref, int params, const char **param); |
| 146 | 148 | static void execute_snap(running_machine &machine, int ref, int params, const char **param); |
| 147 | 149 | static void execute_source(running_machine &machine, int ref, int params, const char **param); |
| 148 | 150 | static void execute_map(running_machine &machine, int ref, int params, const char **param); |
| r22724 | r22725 | |
| 292 | 294 | debug_console_register_command(machine, "ignore", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_ignore); |
| 293 | 295 | debug_console_register_command(machine, "observe", CMDFLAG_NONE, 0, 0, MAX_COMMAND_PARAMS, execute_observe); |
| 294 | 296 | |
| 295 | | debug_console_register_command(machine, "comadd", CMDFLAG_NONE, 0, 1, 2, execute_comment); |
| 297 | debug_console_register_command(machine, "comadd", CMDFLAG_NONE, 0, 1, 2, execute_comment); |
| 296 | 298 | debug_console_register_command(machine, "//", CMDFLAG_NONE, 0, 1, 2, execute_comment); |
| 297 | | debug_console_register_command(machine, "comdelete", CMDFLAG_NONE, 0, 1, 1, execute_comment_del); |
| 298 | | debug_console_register_command(machine, "comsave", CMDFLAG_NONE, 0, 0, 0, execute_comment_save); |
| 299 | debug_console_register_command(machine, "comdelete", CMDFLAG_NONE, 0, 1, 1, execute_comment_del); |
| 300 | debug_console_register_command(machine, "comsave", CMDFLAG_NONE, 0, 0, 0, execute_comment_save); |
| 299 | 301 | |
| 300 | 302 | debug_console_register_command(machine, "bpset", CMDFLAG_NONE, 0, 1, 3, execute_bpset); |
| 301 | 303 | debug_console_register_command(machine, "bp", CMDFLAG_NONE, 0, 1, 3, execute_bpset); |
| r22724 | r22725 | |
| 369 | 371 | debug_console_register_command(machine, "history", CMDFLAG_NONE, 0, 0, 2, execute_history); |
| 370 | 372 | debug_console_register_command(machine, "trackpc", CMDFLAG_NONE, 0, 0, 3, execute_trackpc); |
| 371 | 373 | |
| 374 | debug_console_register_command(machine, "trackmem", CMDFLAG_NONE, 0, 0, 3, execute_trackmem); |
| 375 | debug_console_register_command(machine, "pcatmemp", CMDFLAG_NONE, AS_PROGRAM, 1, 2, execute_pcatmem); |
| 376 | debug_console_register_command(machine, "pcatmemd", CMDFLAG_NONE, AS_DATA, 1, 2, execute_pcatmem); |
| 377 | debug_console_register_command(machine, "pcatmemi", CMDFLAG_NONE, AS_IO, 1, 2, execute_pcatmem); |
| 378 | |
| 372 | 379 | debug_console_register_command(machine, "snap", CMDFLAG_NONE, 0, 0, 1, execute_snap); |
| 373 | 380 | |
| 374 | 381 | debug_console_register_command(machine, "source", CMDFLAG_NONE, 0, 1, 1, execute_source); |
| r22724 | r22725 | |
| 2695 | 2702 | |
| 2696 | 2703 | |
| 2697 | 2704 | /*------------------------------------------------- |
| 2705 | execute_trackmem - execute the trackmem command |
| 2706 | -------------------------------------------------*/ |
| 2707 | |
| 2708 | static void execute_trackmem(running_machine &machine, int ref, int params, const char *param[]) |
| 2709 | { |
| 2710 | // Gather the on/off switch (if present) |
| 2711 | UINT64 turnOn = true; |
| 2712 | if (!debug_command_parameter_number(machine, param[0], &turnOn)) |
| 2713 | return; |
| 2714 | |
| 2715 | // Gather the cpu id (if present) |
| 2716 | device_t *cpu = NULL; |
| 2717 | if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : NULL, &cpu)) |
| 2718 | return; |
| 2719 | |
| 2720 | // Should we clear the existing data? |
| 2721 | UINT64 clear = false; |
| 2722 | if (!debug_command_parameter_number(machine, param[2], &clear)) |
| 2723 | return; |
| 2724 | |
| 2725 | // Get the address space for the given cpu |
| 2726 | address_space *space; |
| 2727 | if (!debug_command_parameter_cpu_space(machine, (params > 1) ? param[1] : NULL, AS_PROGRAM, space)) |
| 2728 | return; |
| 2729 | |
| 2730 | // Inform the CPU it's time to start tracking memory writes |
| 2731 | cpu->debug()->set_track_mem(turnOn); |
| 2732 | |
| 2733 | // Use the watchpoint system to catch memory writes |
| 2734 | space->enable_write_watchpoints(true); |
| 2735 | |
| 2736 | // Clear out the existing data if requested |
| 2737 | if (clear) |
| 2738 | space->device().debug()->track_mem_data_clear(); |
| 2739 | } |
| 2740 | |
| 2741 | |
| 2742 | /*------------------------------------------------- |
| 2743 | execute_pcatmem - execute the pcatmem command |
| 2744 | -------------------------------------------------*/ |
| 2745 | |
| 2746 | static void execute_pcatmem(running_machine &machine, int ref, int params, const char *param[]) |
| 2747 | { |
| 2748 | // Gather the required address parameter |
| 2749 | UINT64 address; |
| 2750 | if (!debug_command_parameter_number(machine, param[0], &address)) |
| 2751 | return; |
| 2752 | |
| 2753 | // Gather the cpu id (if present) |
| 2754 | device_t *cpu = NULL; |
| 2755 | if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : NULL, &cpu)) |
| 2756 | return; |
| 2757 | |
| 2758 | // Get the address space for the given cpu |
| 2759 | address_space *space; |
| 2760 | if (!debug_command_parameter_cpu_space(machine, (params > 1) ? param[1] : NULL, ref, space)) |
| 2761 | return; |
| 2762 | |
| 2763 | // Get the value of memory at the address |
| 2764 | const int nativeDataWidth = space->data_width() / 8; |
| 2765 | const UINT64 data = debug_read_memory(*space, |
| 2766 | space->address_to_byte(address), |
| 2767 | nativeDataWidth, |
| 2768 | true); |
| 2769 | |
| 2770 | // Recover the pc & print |
| 2771 | const address_spacenum spaceNum = (address_spacenum)ref; |
| 2772 | const offs_t result = space->device().debug()->track_mem_pc_from_space_address_data(spaceNum, address, data); |
| 2773 | if (result != (offs_t)(-1)) |
| 2774 | debug_console_printf(machine, "%02x\n", result); |
| 2775 | else |
| 2776 | debug_console_printf(machine, "UNKNOWN PC\n"); |
| 2777 | } |
| 2778 | |
| 2779 | |
| 2780 | /*------------------------------------------------- |
| 2698 | 2781 | execute_snap - execute the snapshot command |
| 2699 | 2782 | -------------------------------------------------*/ |
| 2700 | 2783 | |
trunk/src/emu/debug/debughlp.c
| r22724 | r22725 | |
| 88 | 88 | " logerror <format>[,<item>[,...]] -- outputs one or more <item>s to the error.log\n" |
| 89 | 89 | " tracelog <format>[,<item>[,...]] -- outputs one or more <item>s to the trace file using <format>\n" |
| 90 | 90 | " history [<cpu>,<length>] -- outputs a brief history of visited opcodes.\n" |
| 91 | | " trackpc [<bool>,<cpu>,<bool>] -- toggle to visually track visited opcodes [for the given cpu [& clear]].\n" |
| 91 | " trackpc [<bool>,<cpu>,<bool>] -- visually track visited opcodes [boolean to turn on and off, for the given cpu, clear].\n" |
| 92 | " trackmem [<bool>,<bool>] -- record which PC writes to each memory address [boolean to turn on and off, clear].\n" |
| 93 | " pcatmemp <address>[,<cpu>] -- query which PC wrote to a given program memory address for the current CPU.\n" |
| 94 | " pcatmemd <address>[,<cpu>] -- query which PC wrote to a given data memory address for the current CPU.\n" |
| 95 | " pcatmemi <address>[,<cpu>] -- query which PC wrote to a given I/O memory address for the current CPU.\n" |
| 96 | " (Note: you can also query this info by right clicking in a memory window.\n" |
| 92 | 97 | " snap [<filename>] -- save a screen snapshot\n" |
| 93 | 98 | " source <filename> -- reads commands from <filename> and executes them one by one\n" |
| 94 | 99 | " quit -- exits MAME and the debugger\n" |
| r22724 | r22725 | |
| 391 | 396 | "trackpc 1\n" |
| 392 | 397 | " Begin tracking the current cpu's pc.\n" |
| 393 | 398 | "\n" |
| 394 | | "trackpc 1, 0, 0\n" |
| 399 | "trackpc 1, 0, 1\n" |
| 395 | 400 | " Continue tracking pc on cpu 0, but clear existing track info.\n" |
| 396 | 401 | }, |
| 397 | 402 | { |
| 403 | "trackmem", |
| 404 | "\n" |
| 405 | " trackmem [<bool>,<cpu>,<bool>]\n" |
| 406 | "\n" |
| 407 | "The trackmem command logs the PC at each time a memory address is written to. " |
| 408 | "The first boolean argument toggles the process on and off. The second argument is a cpu " |
| 409 | "selector; if no cpu is specified, the current cpu is automatically selected. The third argument " |
| 410 | " is a boolean denoting if the existing data should be cleared or not. Please refer to the " |
| 411 | "pcatmem command for information on how to retrieve this data. Also, right clicking in " |
| 412 | "a memory window will display the logged PC for the given address.\n" |
| 413 | "\n" |
| 414 | "Examples:\n" |
| 415 | "\n" |
| 416 | "trackmem\n" |
| 417 | " Begin tracking the current CPU's pc.\n" |
| 418 | "\n" |
| 419 | "trackmem 1, 0, 1\n" |
| 420 | " Continue tracking memory writes on cpu 0, but clear existing track info.\n" |
| 421 | }, |
| 422 | { |
| 423 | "pcatmem", |
| 424 | "\n" |
| 425 | " pcatmem(p/d/i) <address>[,<cpu>]\n" |
| 426 | "\n" |
| 427 | "The pcatmem command returns which PC wrote to a given memory address for the current CPU. " |
| 428 | "The first argument is the requested address. The second argument is a cpu selector; if no " |
| 429 | "cpu is specified, the current cpu is automatically selected. Right clicking in a memory window " |
| 430 | "will also display the logged PC for the given address.\n" |
| 431 | "\n" |
| 432 | "Examples:\n" |
| 433 | "\n" |
| 434 | "pcatmem 400000\n" |
| 435 | " Print which PC wrote this CPU's memory location 0x400000.\n" |
| 436 | }, |
| 437 | { |
| 398 | 438 | "snap", |
| 399 | 439 | "\n" |
| 400 | 440 | " snap [[<filename>], <scrnum>]\n" |
trunk/src/emu/debug/debugcpu.c
| r22724 | r22725 | |
| 1663 | 1663 | m_track_pc_set(), |
| 1664 | 1664 | m_track_pc(false), |
| 1665 | 1665 | m_comment_set(), |
| 1666 | | m_comment_change(0) |
| 1666 | m_comment_change(0), |
| 1667 | m_track_mem_set(), |
| 1668 | m_track_mem(false) |
| 1667 | 1669 | { |
| 1668 | 1670 | memset(m_pc_history, 0, sizeof(m_pc_history)); |
| 1669 | 1671 | memset(m_wplist, 0, sizeof(m_wplist)); |
| r22724 | r22725 | |
| 2023 | 2025 | |
| 2024 | 2026 | void device_debug::memory_write_hook(address_space &space, offs_t address, UINT64 data, UINT64 mem_mask) |
| 2025 | 2027 | { |
| 2028 | if (m_track_mem) |
| 2029 | { |
| 2030 | dasm_memory_access newAccess(space.spacenum(), address, data, history_pc(0)); |
| 2031 | if (!m_track_mem_set.insert(newAccess)) |
| 2032 | { |
| 2033 | m_track_mem_set.remove(newAccess); |
| 2034 | m_track_mem_set.insert(newAccess); |
| 2035 | } |
| 2036 | } |
| 2026 | 2037 | watchpoint_check(space, WATCHPOINT_WRITE, address, data, mem_mask); |
| 2027 | 2038 | } |
| 2028 | 2039 | |
| r22724 | r22725 | |
| 2631 | 2642 | |
| 2632 | 2643 | |
| 2633 | 2644 | //------------------------------------------------- |
| 2645 | // track_mem_pc_from_address_data - returns the pc that |
| 2646 | // wrote the data to this address or (offs_t)(-1) for |
| 2647 | // 'not available'. |
| 2648 | //------------------------------------------------- |
| 2649 | |
| 2650 | offs_t device_debug::track_mem_pc_from_space_address_data(const address_spacenum& space, |
| 2651 | const offs_t& address, |
| 2652 | const UINT64& data) const |
| 2653 | { |
| 2654 | const offs_t missing = (offs_t)(-1); |
| 2655 | if (m_track_mem_set.empty()) |
| 2656 | return missing; |
| 2657 | dasm_memory_access* mem_access = m_track_mem_set.find(dasm_memory_access(space, address, data, 0)); |
| 2658 | if (mem_access == NULL) return missing; |
| 2659 | return mem_access->m_pc; |
| 2660 | } |
| 2661 | |
| 2662 | |
| 2663 | //------------------------------------------------- |
| 2634 | 2664 | // comment_add - adds a comment to the list at |
| 2635 | 2665 | // the given address |
| 2636 | 2666 | //------------------------------------------------- |
| r22724 | r22725 | |
| 2672 | 2702 | |
| 2673 | 2703 | const char *device_debug::comment_text(offs_t addr) const |
| 2674 | 2704 | { |
| 2675 | | const UINT32 crc = compute_opcode_crc32(addr); |
| 2705 | const UINT32 crc = compute_opcode_crc32(addr); |
| 2676 | 2706 | dasm_comment* comment = m_comment_set.find(dasm_comment(addr, crc, "", 0)); |
| 2677 | 2707 | if (comment == NULL) return NULL; |
| 2678 | 2708 | return comment->m_text; |
| r22724 | r22725 | |
| 3523 | 3553 | |
| 3524 | 3554 | device_debug::dasm_pc_tag::dasm_pc_tag(const offs_t& address, const UINT32& crc) |
| 3525 | 3555 | : m_address(address), |
| 3526 | | m_crc(crc) |
| 3556 | m_crc(crc) |
| 3527 | 3557 | { |
| 3528 | 3558 | } |
| 3529 | 3559 | |
| 3530 | 3560 | //------------------------------------------------- |
| 3561 | // dasm_memory_access - constructor |
| 3562 | //------------------------------------------------- |
| 3563 | |
| 3564 | device_debug::dasm_memory_access::dasm_memory_access(const address_spacenum& address_space, |
| 3565 | const offs_t& address, |
| 3566 | const UINT64& data, |
| 3567 | const offs_t& pc) |
| 3568 | : m_address_space(address_space), |
| 3569 | m_address(address), |
| 3570 | m_data(data), |
| 3571 | m_pc(pc) |
| 3572 | { |
| 3573 | } |
| 3574 | |
| 3575 | //------------------------------------------------- |
| 3531 | 3576 | // dasm_comment - constructor |
| 3532 | 3577 | //------------------------------------------------- |
| 3533 | 3578 | |
| 3534 | 3579 | device_debug::dasm_comment::dasm_comment(offs_t address, UINT32 crc, const char *text, rgb_t color) |
| 3535 | 3580 | : dasm_pc_tag(address, crc), |
| 3536 | | m_text(text), |
| 3537 | | m_color(color) |
| 3581 | m_text(text), |
| 3582 | m_color(color) |
| 3538 | 3583 | { |
| 3539 | 3584 | } |