Mercurial > repos > blastem
comparison debug.c @ 2181:0c723b8b637c
Add bindup and binddown debugger commands
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 13 Aug 2022 20:04:02 -0700 |
parents | b87658ba3b94 |
children | 2d7f8195be3b |
comparison
equal
deleted
inserted
replaced
2180:b87658ba3b94 | 2181:0c723b8b637c |
---|---|
1 #include "debug.h" | 1 #include "debug.h" |
2 #include "genesis.h" | 2 #include "genesis.h" |
3 #include "68kinst.h" | 3 #include "68kinst.h" |
4 #include "segacd.h" | 4 #include "segacd.h" |
5 #include "blastem.h" | 5 #include "blastem.h" |
6 #include "bindings.h" | |
6 #include <ctype.h> | 7 #include <ctype.h> |
7 #include <stdlib.h> | 8 #include <stdlib.h> |
8 #include <string.h> | 9 #include <string.h> |
9 #ifndef _WIN32 | 10 #ifndef _WIN32 |
10 #include <sys/select.h> | 11 #include <sys/select.h> |
1308 { | 1309 { |
1309 current_system->enter_debugger_frames = args[0].value; | 1310 current_system->enter_debugger_frames = args[0].value; |
1310 return 0; | 1311 return 0; |
1311 } | 1312 } |
1312 | 1313 |
1314 static uint8_t cmd_bindup(debug_root *root, char *format, char *param) | |
1315 { | |
1316 if (!bind_up(param)) { | |
1317 fprintf(stderr, "%s is not a valid binding name\n", param); | |
1318 } | |
1319 return 1; | |
1320 } | |
1321 | |
1322 static uint8_t cmd_binddown(debug_root *root, char *format, char *param) | |
1323 { | |
1324 if (!bind_down(param)) { | |
1325 fprintf(stderr, "%s is not a valid binding name\n", param); | |
1326 } | |
1327 return 1; | |
1328 } | |
1329 | |
1313 static uint8_t cmd_delete_m68k(debug_root *root, char *format, int num_args, command_arg *args) | 1330 static uint8_t cmd_delete_m68k(debug_root *root, char *format, int num_args, command_arg *args) |
1314 { | 1331 { |
1315 bp_def **this_bp = find_breakpoint_idx(&root->breakpoints, args[0].value); | 1332 bp_def **this_bp = find_breakpoint_idx(&root->breakpoints, args[0].value); |
1316 if (!*this_bp) { | 1333 if (!*this_bp) { |
1317 fprintf(stderr, "Breakpoint %d does not exist\n", args[0].value); | 1334 fprintf(stderr, "Breakpoint %d does not exist\n", args[0].value); |
1695 "frames", NULL | 1712 "frames", NULL |
1696 }, | 1713 }, |
1697 .usage = "frames EXPRESSION", | 1714 .usage = "frames EXPRESSION", |
1698 .desc = "Resume execution for EXPRESSION video frames", | 1715 .desc = "Resume execution for EXPRESSION video frames", |
1699 .impl = cmd_frames, | 1716 .impl = cmd_frames, |
1717 .min_args = 1, | |
1718 .max_args = 1 | |
1719 }, | |
1720 { | |
1721 .names = (const char *[]){ | |
1722 "bindup", NULL | |
1723 }, | |
1724 .usage = "bindup NAME", | |
1725 .desc = "Simulate a keyup for binding NAME", | |
1726 .raw_impl = cmd_bindup, | |
1727 .min_args = 1, | |
1728 .max_args = 1 | |
1729 }, | |
1730 { | |
1731 .names = (const char *[]){ | |
1732 "binddown", NULL | |
1733 }, | |
1734 .usage = "bindown NAME", | |
1735 .desc = "Simulate a keydown for binding NAME", | |
1736 .raw_impl = cmd_binddown, | |
1700 .min_args = 1, | 1737 .min_args = 1, |
1701 .max_args = 1 | 1738 .max_args = 1 |
1702 } | 1739 } |
1703 }; | 1740 }; |
1704 #define NUM_COMMON (sizeof(common_commands)/sizeof(*common_commands)) | 1741 #define NUM_COMMON (sizeof(common_commands)/sizeof(*common_commands)) |