comparison debug.h @ 2359:04d29635d238

Support for arrays in debugger language
author Michael Pavone <pavone@retrodev.com>
date Sat, 28 Oct 2023 14:39:19 -0700
parents 4b2ac43c106e
children 3350b3c8faa8
comparison
equal deleted inserted replaced
2358:4b2ac43c106e 2359:04d29635d238
13 13
14 typedef enum { 14 typedef enum {
15 TOKEN_NONE, 15 TOKEN_NONE,
16 TOKEN_NUM, 16 TOKEN_NUM,
17 TOKEN_NAME, 17 TOKEN_NAME,
18 TOKEN_ARRAY,
18 TOKEN_OPER, 19 TOKEN_OPER,
19 TOKEN_SIZE, 20 TOKEN_SIZE,
20 TOKEN_LBRACKET, 21 TOKEN_LBRACKET,
21 TOKEN_RBRACKET, 22 TOKEN_RBRACKET,
22 TOKEN_LPAREN, 23 TOKEN_LPAREN,
104 uint32_t num_commands; 105 uint32_t num_commands;
105 uint32_t address; 106 uint32_t address;
106 uint32_t index; 107 uint32_t index;
107 } bp_def; 108 } bp_def;
108 109
110 typedef struct debug_array debug_array;
111 typedef uint32_t (*debug_array_get)(debug_root *root, debug_array *array, uint32_t index);
112 typedef void (*debug_array_set)(debug_root *root, debug_array *array, uint32_t index, uint32_t value);
113 typedef void (*debug_array_append)(debug_root *root, debug_array *array, uint32_t value);
114
115 struct debug_array{
116 debug_array_get get;
117 debug_array_set set;
118 debug_array_append append;
119 uint32_t *data;
120 uint32_t size;
121 uint32_t storage;
122 };
123
109 typedef uint8_t (*resolver)(debug_root *root, const char *name, uint32_t *out); 124 typedef uint8_t (*resolver)(debug_root *root, const char *name, uint32_t *out);
125 typedef debug_array* (*array_resolver)(debug_root *root, const char *name);
110 typedef uint8_t (*setter)(debug_root *root, const char *name, uint32_t value); 126 typedef uint8_t (*setter)(debug_root *root, const char *name, uint32_t value);
111 typedef uint8_t (*reader)(debug_root *root, uint32_t *out, char size); 127 typedef uint8_t (*reader)(debug_root *root, uint32_t *out, char size);
112 typedef uint8_t (*writer)(debug_root *root, uint32_t address, uint32_t value, char size); 128 typedef uint8_t (*writer)(debug_root *root, uint32_t address, uint32_t value, char size);
113 129
114 struct debug_root { 130 struct debug_root {
116 bp_def *breakpoints; 132 bp_def *breakpoints;
117 disp_def *displays; 133 disp_def *displays;
118 tern_node *commands; 134 tern_node *commands;
119 tern_node *symbols; 135 tern_node *symbols;
120 tern_node *variables; 136 tern_node *variables;
137 tern_node *arrays;
121 disasm_context *disasm; 138 disasm_context *disasm;
122 resolver resolve; 139 resolver resolve;
140 array_resolver array_resolve;
123 reader read_mem; 141 reader read_mem;
124 setter set; 142 setter set;
125 writer write_mem; 143 writer write_mem;
126 parsed_command last_cmd; 144 parsed_command last_cmd;
127 uint32_t bp_index; 145 uint32_t bp_index;