Mercurial > repos > blastem
comparison debug.c @ 1921:5d028088e320
Added help commands to debugger
author | Eric Fry <yuv422@users.noreply.github.com> |
---|---|
date | Fri, 10 Apr 2020 13:30:16 +1000 |
parents | 7b41cb36e7df |
children | 4a811fd1fb6f |
comparison
equal
deleted
inserted
replaced
1920:7b41cb36e7df | 1921:5d028088e320 |
---|---|
550 } else { | 550 } else { |
551 fputs("Failed to find a RAM memory chunk\n", stderr); | 551 fputs("Failed to find a RAM memory chunk\n", stderr); |
552 } | 552 } |
553 break; | 553 break; |
554 } | 554 } |
555 case '?': | |
556 print_z80_help(); | |
557 break; | |
555 default: | 558 default: |
556 if ( | 559 if ( |
557 !context->Z80_OPTS->gen.debug_cmd_handler | 560 !context->Z80_OPTS->gen.debug_cmd_handler |
558 || !context->Z80_OPTS->gen.debug_cmd_handler(&system->header, input_buf) | 561 || !context->Z80_OPTS->gen.debug_cmd_handler(&system->header, input_buf) |
559 ) { | 562 ) { |
560 fprintf(stderr, "Unrecognized debugger command %s\n", input_buf); | 563 fprintf(stderr, "Unrecognized debugger command %s\nUse '?' for help.\n", input_buf); |
561 } | 564 } |
562 break; | 565 break; |
563 } | 566 } |
564 } | 567 } |
565 return context; | 568 return context; |
923 zdebugger_print(gen->z80, input_buf[2] == '/' ? input_buf[3] : 0, param); | 926 zdebugger_print(gen->z80, input_buf[2] == '/' ? input_buf[3] : 0, param); |
924 } | 927 } |
925 break; | 928 break; |
926 } | 929 } |
927 #endif | 930 #endif |
931 case '?': | |
932 print_m68k_help(); | |
933 break; | |
928 case 'q': | 934 case 'q': |
929 puts("Quitting"); | 935 puts("Quitting"); |
930 exit(0); | 936 exit(0); |
931 break; | 937 break; |
932 default: | 938 default: |
933 fprintf(stderr, "Unrecognized debugger command %s\n", input_buf); | 939 fprintf(stderr, "Unrecognized debugger command %s\nUse '?' for help.\n", input_buf); |
934 break; | 940 break; |
935 } | 941 } |
936 return 1; | 942 return 1; |
937 } | 943 } |
938 | 944 |
945 void print_m68k_help() | |
946 { | |
947 printf("M68k Debugger Commands\n"); | |
948 printf(" b ADDRESS - Set a breakpoint at ADDRESS\n"); | |
949 printf(" d BREAKPOINT - Delete a 68K breakpoint\n"); | |
950 printf(" co BREAKPOINT - Run a list of debugger commands each time\n"); | |
951 printf(" BREAKPOINT is hit\n"); | |
952 printf(" a ADDRESS - Advance to address\n"); | |
953 printf(" n - Advance to next instruction\n"); | |
954 printf(" o - Advance to next instruction ignoring branches to\n"); | |
955 printf(" lower addresses (good for breaking out of loops)\n"); | |
956 printf(" s - Advance to next instruction (follows bsr/jsr)\n"); | |
957 printf(" c - Continue\n"); | |
958 printf(" bt - Print a backtrace\n"); | |
959 printf(" p[/(x|X|d|c)] VALUE - Print a register or memory location\n"); | |
960 printf(" di[/(x|X|d|c)] VALUE - Print a register or memory location each time\n"); | |
961 printf(" a breakpoint is hit\n"); | |
962 printf(" vs - Print VDP sprite list\n"); | |
963 printf(" vr - Print VDP register info\n"); | |
964 printf(" zb ADDRESS - Set a Z80 breakpoint\n"); | |
965 printf(" zp[/(x|X|d|c)] VALUE - Display a Z80 value\n"); | |
966 printf(" ? - Display help\n"); | |
967 printf(" q - Quit BlastEm\n"); | |
968 } | |
969 | |
970 void print_z80_help() | |
971 { | |
972 printf("Z80 Debugger Commands\n"); | |
973 printf(" b ADDRESS - Set a breakpoint at ADDRESS\n"); | |
974 printf(" de BREAKPOINT - Delete a Z80 breakpoint\n"); | |
975 printf(" a ADDRESS - Advance to address\n"); | |
976 printf(" n - Advance to next instruction\n"); | |
977 printf(" c - Continue\n"); | |
978 printf(" p[/(x|X|d|c)] VALUE - Print a register or memory location\n"); | |
979 printf(" di[/(x|X|d|c)] VALUE - Print a register or memory location each time\n"); | |
980 printf(" a breakpoint is hit\n"); | |
981 printf(" q - Quit BlastEm\n"); | |
982 } | |
939 | 983 |
940 void debugger(m68k_context * context, uint32_t address) | 984 void debugger(m68k_context * context, uint32_t address) |
941 { | 985 { |
942 static char last_cmd[1024]; | 986 static char last_cmd[1024]; |
943 char input_buf[1024]; | 987 char input_buf[1024]; |