/** * Remote/parallel debugger line usage API. * Return false for failed command, true for success. */ bool DebugUI_ParseLine(const char *input) { char *expanded; int ret = 0; DebugUI_Init(); /* returns new string if input needed expanding! */ expanded = DebugUI_EvaluateExpressions(input); if (expanded) { fprintf(stderr, "> %s\n", expanded); ret = DebugUI_ParseCommand(expanded); free(expanded); DebugCpu_SetDebugging(); DebugDsp_SetDebugging(); } return (ret == DEBUGGER_CMDDONE); }
/** * Debugger user interface main function. */ void DebugUI(debug_reason_t reason) { int cmdret, alertLevel; char *expCmd, *psCmd = NULL; static const char *welcome = "\n----------------------------------------------------------------------" "\nYou have entered debug mode. Type c to continue emulation, h for help.\n"; History_Mark(reason); if (bInFullScreen) Screen_ReturnFromFullScreen(); /* Make sure mouse isn't grabbed regardless of where * this is invoked from. E.g. returning from fullscreen * enables grab if that was enabled on windowed mode. */ SDL_WM_GrabInput(SDL_GRAB_OFF); DebugUI_Init(); if (welcome) { fputs(welcome, stderr); welcome = NULL; } DebugCpu_InitSession(); DebugDsp_InitSession(); Symbols_LoadCurrentProgram(); DebugInfo_ShowSessionInfo(); /* override paused message so that user knows to look into console * on how to continue in case he invoked the debugger by accident. */ Statusbar_AddMessage("Console Debugger", 100); Statusbar_Update(sdlscrn, true); /* disable normal GUI alerts while on console */ alertLevel = Log_SetAlertLevel(LOG_FATAL); cmdret = DEBUGGER_CMDDONE; do { /* Read command from the keyboard and give previous * command for freeing / adding to history */ psCmd = DebugUI_GetCommand(psCmd); if (!psCmd) break; /* returns new expression expanded string */ if (!(expCmd = DebugUI_EvaluateExpressions(psCmd))) continue; /* Parse and execute the command string */ cmdret = DebugUI_ParseCommand(expCmd); free(expCmd); } while (cmdret != DEBUGGER_END); /* free exit command */ DebugUI_FreeCommand(psCmd); Log_SetAlertLevel(alertLevel); DebugUI_SetLogDefault(); DebugCpu_SetDebugging(); DebugDsp_SetDebugging(); }
/** * Initialise emulation */ static void Main_Init(void) { /* Open debug log file */ if (!Log_Init()) { fprintf(stderr, "Logging/tracing initialization failed\n"); exit(-1); } Log_Printf(LOG_INFO, PROG_NAME ", compiled on: " __DATE__ ", " __TIME__ "\n"); /* Init SDL's video subsystem. Note: Audio and joystick subsystems will be initialized later (failures there are not fatal). */ if (SDL_Init(SDL_INIT_VIDEO | Opt_GetNoParachuteFlag()) < 0) { fprintf(stderr, "Could not initialize the SDL library:\n %s\n", SDL_GetError() ); exit(-1); } ClocksTimings_InitMachine ( ConfigureParams.System.nMachineType ); Resolution_Init(); SDLGui_Init(); Screen_Init(); Main_SetTitle(NULL); // HostScreen_Init(); DSP_Init(); // Floppy_Init(); M68000_Init(); /* Init CPU emulation */ // Audio_Init(); // DmaSnd_Init(); Keymap_Init(); /* call menu at startup */ if (!File_Exists(sConfigFileName) || ConfigureParams.ConfigDialog.bShowConfigDialogAtStartup) Dialog_DoProperty(); else Dialog_CheckFiles(); if (bQuitProgram) { SDL_Quit(); exit(-2); } // const char *err_msg; // // while ((err_msg=Reset_Cold())!=NULL) // { // DlgMissing_Rom(); // if (bQuitProgram) { // Main_RequestQuit(); // break; // } // } Reset_Cold(); // if (bQuitProgram) { // SDL_Quit(); // exit(-2); // } IoMem_Init(); /* done as last, needs CPU & DSP running... */ DebugUI_Init(); }