src/osd/sdl/debugosx.c
| r2909 | r2910 | |
| 32 | 32 | #include "debug/debugvw.h" |
| 33 | 33 | #include "debug/debugcon.h" |
| 34 | 34 | #include "debug/debugcpu.h" |
| 35 | #include "debugger.h" |
| 35 | 36 | |
| 36 | 37 | // MAMEOS headers |
| 37 | 38 | #include "debugwin.h" |
| r2909 | r2910 | |
| 459 | 460 | |
| 460 | 461 | void debugwin_update_during_game(void) |
| 461 | 462 | { |
| 462 | | int execution_state = debug_get_execution_state(); |
| 463 | | |
| 464 | 463 | { |
| 465 | 464 | static int osx_inited_debugger = 0; |
| 466 | 465 | |
| r2909 | r2910 | |
| 476 | 475 | } |
| 477 | 476 | |
| 478 | 477 | // if we're running live, do some checks |
| 479 | | if (execution_state != EXECUTION_STATE_STOPPED) |
| 478 | if ( ! debug_cpu_is_stopped(Machine) ) |
| 480 | 479 | { |
| 481 | 480 | // see if the interrupt key is pressed and break if it is |
| 482 | 481 | temporarily_fake_that_we_are_not_visible = TRUE; |
| r2909 | r2910 | |
| 490 | 489 | focuswnd = NULL; |
| 491 | 490 | } |
| 492 | 491 | |
| 493 | | debug_halt_on_next_instruction(); |
| 492 | debugger_break(Machine); |
| 494 | 493 | debug_console_printf("User-initiated break\n"); |
| 495 | 494 | |
| 496 | 495 | // if we were focused on some window's edit box, reset it to default |
| r2909 | r2910 | |
| 543 | 542 | |
| 544 | 543 | debugwin_info *info = NULL; |
| 545 | 544 | Rect work_bounds; |
| 546 | | |
| 545 | |
| 547 | 546 | (void)unused; |
| 548 | | |
| 547 | |
| 549 | 548 | // allocate memory |
| 550 | 549 | info = malloc(sizeof(*info)); |
| 551 | 550 | if (!info) |
| 552 | 551 | return NULL; |
| 553 | 552 | memset(info, 0, sizeof(*info)); |
| 554 | | |
| 553 | |
| 555 | 554 | info->wnd = NULL; |
| 556 | 555 | |
| 557 | 556 | // create the window |
| r2909 | r2910 | |
| 560 | 559 | |
| 561 | 560 | if ( CreateNewWindow(kDocumentWindowClass, DEBUG_WINDOW_STYLE, &work_bounds, &info->wnd) != noErr ) |
| 562 | 561 | goto cleanup; |
| 563 | | |
| 562 | |
| 564 | 563 | // install keyboard handler |
| 565 | 564 | if ( keyEventHandler == NULL ) |
| 566 | 565 | { |
| r2909 | r2910 | |
| 1977 | 1976 | // then add all the memory regions |
| 1978 | 1977 | for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++) |
| 1979 | 1978 | { |
| 1980 | | UINT8 *base = memory_region(rgnnum); |
| 1979 | UINT8 *base = memory_region(Machine, rgnnum); |
| 1981 | 1980 | UINT32 type = memory_region_type(Machine, rgnnum); |
| 1982 | 1981 | if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names)) |
| 1983 | 1982 | { |
| r2909 | r2910 | |
| 1986 | 1985 | UINT8 width, little_endian; |
| 1987 | 1986 | memset(ci, 0, sizeof(*ci)); |
| 1988 | 1987 | ci->base = base; |
| 1989 | | ci->length = memory_region_length(rgnnum); |
| 1988 | ci->length = memory_region_length(Machine, rgnnum); |
| 1990 | 1989 | width = 1 << (flags & ROMREGION_WIDTHMASK); |
| 1991 | 1990 | little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); |
| 1992 | 1991 | if (type >= REGION_CPU1 && type <= REGION_CPU8) |
| r2909 | r2910 | |
| 2871 | 2870 | cpu_num = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM); |
| 2872 | 2871 | cpuinfo = (debug_cpu_info*)debug_get_cpu_info(cpu_num); |
| 2873 | 2872 | |
| 2874 | | for (bp = cpuinfo->first_bp; bp; bp = bp->next) |
| 2873 | for (bp = cpuinfo->bplist; bp; bp = bp->next) |
| 2875 | 2874 | { |
| 2876 | 2875 | if (BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM) == bp->address) |
| 2877 | 2876 | { |
| r2909 | r2910 | |
| 2965 | 2964 | cpu_num = debug_view_get_property_UINT32(info->view[0].view, DVP_DASM_CPUNUM); |
| 2966 | 2965 | cpuinfo = (debug_cpu_info*)debug_get_cpu_info(cpu_num); |
| 2967 | 2966 | |
| 2968 | | for (bp = cpuinfo->first_bp; bp; bp = bp->next) |
| 2967 | for (bp = cpuinfo->bplist; bp; bp = bp->next) |
| 2969 | 2968 | { |
| 2970 | 2969 | if (BYTE2ADDR(active_address, cpuinfo, ADDRESS_SPACE_PROGRAM) == bp->address) |
| 2971 | 2970 | { |
| r2909 | r2910 | |
| 3043 | 3042 | MenuItemIndex menuIndex; |
| 3044 | 3043 | ControlButtonContentInfo content; |
| 3045 | 3044 | |
| 3045 | debugwin_init_windows(); |
| 3046 | |
| 3046 | 3047 | // create the window |
| 3047 | 3048 | info = debug_window_create("Debug", NULL); |
| 3048 | 3049 | if (!info) |