Mercurial > repos > blastem
comparison debug.c @ 2703:829205a9647a default tip
Pump events and allow debug window interaction while paused in CPU debugger on Windows
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 04 Jul 2025 21:24:15 -0700 |
parents | 5ca4e0fd761b |
children |
comparison
equal
deleted
inserted
replaced
2702:0a6d644c47aa | 2703:829205a9647a |
---|---|
2294 EMPTY, | 2294 EMPTY, |
2295 ELSE, | 2295 ELSE, |
2296 END | 2296 END |
2297 }; | 2297 }; |
2298 | 2298 |
2299 static void read_wait_progress(void) | |
2300 { | |
2301 process_events(); | |
2302 #ifndef IS_LIB | |
2303 render_update_display(); | |
2304 vdp_context *vdp = current_system->get_vdp(current_system); | |
2305 if (vdp) { | |
2306 vdp_update_per_frame_debug(vdp); | |
2307 } | |
2308 #endif | |
2309 } | |
2310 | |
2299 static uint8_t read_parse_command(debug_root *root, parsed_command *out, int indent_level) | 2311 static uint8_t read_parse_command(debug_root *root, parsed_command *out, int indent_level) |
2300 { | 2312 { |
2301 ++indent_level; | 2313 ++indent_level; |
2302 for (int i = 0; i < indent_level; i++) | 2314 for (int i = 0; i < indent_level; i++) |
2303 { | 2315 { |
2304 putchar('>'); | 2316 putchar('>'); |
2305 } | 2317 } |
2306 putchar(' '); | 2318 putchar(' '); |
2307 fflush(stdout); | 2319 fflush(stdout); |
2308 #ifdef _WIN32 | 2320 read_wait_progress(); |
2309 #define wait 0 | |
2310 #else | |
2311 int wait = 1; | |
2312 fd_set read_fds; | |
2313 FD_ZERO(&read_fds); | |
2314 struct timeval timeout; | |
2315 #endif | |
2316 do { | |
2317 process_events(); | |
2318 #ifndef IS_LIB | |
2319 render_update_display(); | |
2320 vdp_context *vdp = current_system->get_vdp(current_system); | |
2321 if (vdp) { | |
2322 vdp_update_per_frame_debug(vdp); | |
2323 } | |
2324 #endif | |
2325 #ifndef _WIN32 | |
2326 timeout.tv_sec = 0; | |
2327 timeout.tv_usec = 16667; | |
2328 FD_SET(fileno(stdin), &read_fds); | |
2329 if(select(fileno(stdin) + 1, &read_fds, NULL, NULL, &timeout) >= 1) { | |
2330 wait = 0; | |
2331 } | |
2332 #endif | |
2333 } while (wait); | |
2334 | |
2335 char input_buf[1024]; | 2321 char input_buf[1024]; |
2336 if (!fgets(input_buf, sizeof(input_buf), stdin)) { | 2322 if (!fgets_timeout(input_buf, sizeof(input_buf), stdin, 16667, read_wait_progress)) { |
2337 fputs("fgets failed", stderr); | 2323 fputs("fgets failed", stderr); |
2338 return READ_FAILED; | 2324 return READ_FAILED; |
2339 } | 2325 } |
2340 char *stripped = strip_ws(input_buf); | 2326 char *stripped = strip_ws(input_buf); |
2341 if (!stripped[0]) { | 2327 if (!stripped[0]) { |