trunk/src/emu/debug/debugcmd.c
| r21547 | r21548 | |
| 2378 | 2378 | |
| 2379 | 2379 | static void execute_trace_internal(running_machine &machine, int ref, int params, const char *param[], int trace_over) |
| 2380 | 2380 | { |
| 2381 | | const char *action = NULL, *filename = param[0]; |
| 2381 | const char *action = NULL; |
| 2382 | 2382 | device_t *cpu; |
| 2383 | 2383 | FILE *f = NULL; |
| 2384 | 2384 | const char *mode; |
| 2385 | astring filename = param[0]; |
| 2385 | 2386 | |
| 2387 | /* replace macros */ |
| 2388 | filename.replace("{game}", machine.basename()); |
| 2389 | |
| 2386 | 2390 | /* validate parameters */ |
| 2387 | 2391 | if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : NULL, &cpu)) |
| 2388 | 2392 | return; |
| r21547 | r21548 | |
| 2402 | 2406 | if ((filename[0] == '>') && (filename[1] == '>')) |
| 2403 | 2407 | { |
| 2404 | 2408 | mode = "a"; |
| 2405 | | filename += 2; |
| 2409 | filename = filename.substr(2); |
| 2406 | 2410 | } |
| 2407 | 2411 | |
| 2408 | 2412 | f = fopen(filename, mode); |
| r21547 | r21548 | |
| 2416 | 2420 | /* do it */ |
| 2417 | 2421 | cpu->debug()->trace(f, trace_over, action); |
| 2418 | 2422 | if (f) |
| 2419 | | debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag(), filename); |
| 2423 | debug_console_printf(machine, "Tracing CPU '%s' to file %s\n", cpu->tag(), filename.cstr()); |
| 2420 | 2424 | else |
| 2421 | 2425 | debug_console_printf(machine, "Stopped tracing on CPU '%s'\n", cpu->tag()); |
| 2422 | 2426 | } |