9120e874 Andy McCall 25 days ago
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef DEBUG_UI_BRIDGE_H
19
#define DEBUG_UI_BRIDGE_H
20
21
#include < stdint.h>
22
#include < stdbool.h>
23
24
25
26
27
28
#include " cpu/registers.h"
29
30
31
#include " code_map.h"
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include " debug_core.h"
56
#include " debugger.h"
57
58
#include " dbg_info.h"
59
#include " memory.h"
60
#include " glue.h"
61
#include " smc.h"
62
#include " timing.h"
63
#include " perf_budget.h"
64
#include " vera_bandwidth.h"
65
#include " sprite_trace.h"
66
#include " video.h"
67
#include " cpu/irq_ctx.h"
68
#include " cpu/fake6502.h"
69
70
71
72
73
#include " io_trace.h"
74
#include " sdcard.h"
75
#include " sdcard_fat.h"
76
#include " vera_spi.h"
77
#include " joystick.h"
78
#include " via.h"
79
#include " i2c.h"
80
#include " rtc.h"
81
#include " ieee.h"
82
#include " serial.h"
83
84
#ifdef __cplusplus
85
extern " C" {
86
#endif
87
88
89
extern struct regs regs;
90
91
92
93
94
95
96
97
static inline int
98
memory_get_num_rom_banks ( void )
99
{
100
return NUM_ROM_BANKS;
101
}
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
static inline bool
123
DEBUGAddBreakPoint ( struct breakpoint bp)
124
{
125
return debug_bp_add_for ( bp, DEBUG_OWNER_UI ) != DEBUG_ADD_FULL;
126
}
127
128
129
130
131
static inline bool
132
DEBUGRemoveBreakPoint ( int pc, uint8_t bank, int x16Bank)
133
{
134
return debug_bp_delete ( pc, bank, x16Bank ) ;
135
}
136
137
138
139
static inline bool DEBUGSetBreakpointEnabled ( int pc, uint8_t bank, int x16Bank, bool on) { return debug_bp_set_enabled ( pc, bank, x16Bank, on ) ; }
140
static inline bool DEBUGIsBreakpointEnabled ( int pc, uint8_t bank, int x16Bank) { return debug_bp_is_enabled ( pc, bank, x16Bank ) ; }
141
142
static inline void DEBUGForgetBreakpoint ( int pc, uint8_t bank, int x16Bank) { debug_bp_forget ( pc, bank, x16Bank ) ; }
143
static inline void DEBUGClearBreakpointCondition ( int pc, uint8_t bank, int x16Bank) { debug_bp_clear_condition ( pc, bank, x16Bank ) ; }
144
static inline uint32_t DEBUGGetBreakpointHits ( int pc, uint8_t bank, int x16Bank) { return debug_bp_get_hits ( pc, bank, x16Bank ) ; }
145
static inline void DEBUGResetBreakpointHits ( int pc, uint8_t bank, int x16Bank) { debug_bp_reset_hits ( pc, bank, x16Bank ) ; }
146
147
static inline void
148
DEBUGSetBreakpointCondition ( int pc, uint8_t bank, int x16Bank, int operand,
149
uint16_t operand_addr, int op, uint32_t value )
150
{
151
debug_bp_set_condition ( pc, bank, x16Bank, operand, operand_addr, op, value ) ;
152
}
153
154
static inline void
155
DEBUGSetBreakpointIgnore ( int pc, uint8_t bank, int x16Bank, uint32_t ignore)
156
{
157
debug_bp_set_ignore ( pc, bank, x16Bank, ignore ) ;
158
}
159
160
static inline bool
161
DEBUGGetBreakpointCondition ( int pc, uint8_t bank, int x16Bank, int * has_cond,
162
int * operand, uint16_t * operand_addr, int * op,
163
uint32_t * value, uint32_t * ignore )
164
{
165
return debug_bp_get_condition ( pc, bank, x16Bank, has_cond, operand,
166
operand_addr, op, value, ignore ) ;
167
}
168
169
170
171
172
173
enum { BP_OPND_A = BPOPERAND_A, BP_OPND_X = BPOPERAND_X, BP_OPND_Y = BPOPERAND_Y,
174
BP_OPND_SP = BPOPERAND_SP, BP_OPND_P = BPOPERAND_P,
175
BP_OPND_BYTE = BPOPERAND_BYTE, BP_OPND_WORD = BPOPERAND_WORD } ;
176
enum { BP_CMP_EQ = BPCMP_EQ, BP_CMP_NE = BPCMP_NE, BP_CMP_LT = BPCMP_LT,
177
BP_CMP_LE = BPCMP_LE, BP_CMP_GT = BPCMP_GT, BP_CMP_GE = BPCMP_GE } ;
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
void debug_ui_write6502 ( uint16_t address, uint8_t value, uint8_t bank, int16_t x16Bank) ;
202
203
204
205
206
207
208
209
210
211
212
213
214
static inline bool DEBUGAddWatchPoint ( uint16_t addr, uint16_t len) { return debug_wp_add_for ( addr, len, DEBUG_BANK_ANY, DEBUG_OWNER_UI ) != DEBUG_ADD_FULL; }
215
static inline bool DEBUGRemoveWatchPoint ( uint16_t addr) { return debug_wp_delete ( addr, DEBUG_BANK_ANY ) ; }
216
static inline bool DEBUGCheckWatchPoint ( uint16_t addr) { return debug_wp_covers ( addr ) ; }
217
218
219
220
221
222
223
224
extern bool is_gen2;
225
extern uint16_t num_banks;
226
227
228
229
230
231
232
233
234
235
236
static inline const char * debug_server_last_stop_reason ( void ) { return DEBUGGetStopReason ( ) ; }
237
238
239
240
241
242
243
244
245
void debug_ui_set_cursor ( uint16_t addr, uint8_t bank, bool valid) ;
246
247
248
249
250
251
void debug_ui_request_goto ( uint16_t addr, uint8_t bank) ;
252
bool debug_ui_peek_goto ( uint16_t * addr, uint8_t * bank) ;
253
254
255
256
257
258
259
void debug_ui_request_watch ( uint16_t addr, int16_t bank, uint16_t len) ;
260
bool debug_ui_take_watch_request ( uint16_t * addr, int16_t * bank, uint16_t * len) ;
261
262
263
264
265
266
267
extern bool smc_requested_reset;
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#ifdef __cplusplus
294
}
295
#endif
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
#include " vera_psg.h"
314
#include " vera_pcm.h"
315
#include " ymglue.h"
316
317
318
#define DEBUG_UI_CURRENT_BANK ( - 1 )
319
320
321
322
static inline uint8_t
323
debug_ui_read6502 ( uint16_t address , uint8_t bank , int16_t x16Bank )
324
{
325
return real_read6502 ( address, bank, true , x16Bank ) ;
326
}
327
328
329
330
331
static inline void
332
debug_ui_vram_read_range ( uint8_t * dest , uint32_t address , uint32_t size )
333
{
334
for ( uint32_t i = 0 ; i < size; + + i) {
335
dest[ i] = video_space_read ( ( address + i) & 0x1FFFF ) ;
336
}
337
}
338
339
340
341
342
343
344
345
346
static inline bool
347
debug_ui_label_to_addr ( const char * name , uint16_t * addr )
348
{
349
dbg_addr_t wide = 0 ;
350
if ( ! dbg_info_label_to_addr ( name, & wide ) ) return false ;
351
* addr = ( uint16_t ) ( wide & 0xFFFF ) ;
352
return true ;
353
}
354
355
static inline bool
356
debug_ui_source_to_addr ( const char * file , int line , uint16_t * addr )
357
{
358
dbg_addr_t wide = 0 ;
359
if ( ! dbg_info_source_to_addr ( file, line, & wide ) ) return false ;
360
* addr = ( uint16_t ) ( wide & 0xFFFF ) ;
361
return true ;
362
}
363
364
static inline bool
365
debug_ui_symbol_at ( int index , const char * * name , uint16_t * addr )
366
{
367
dbg_addr_t wide = 0 ;
368
if ( ! dbg_info_symbol_at ( index, name, & wide ) ) return false ;
369
* addr = ( uint16_t ) ( wide & 0xFFFF ) ;
370
return true ;
371
}
372
373
static inline bool
374
debug_ui_addr_to_label_nearest ( uint16_t addr , const char * * name , uint16_t * sym_addr )
375
{
376
dbg_addr_t wide = 0 ;
377
if ( ! dbg_info_addr_to_label_nearest ( addr, name, & wide ) ) return false ;
378
* sym_addr = ( uint16_t ) ( wide & 0xFFFF ) ;
379
return true ;
380
}
381
382
static inline bool
383
debug_ui_name_to_value ( const char * name , uint16_t * addr , int * out_kind )
384
{
385
dbg_addr_t wide = 0 ;
386
if ( ! dbg_info_name_to_value ( name, & wide, out_kind ) ) return false ;
387
* addr = ( uint16_t ) ( wide & 0xFFFF ) ;
388
return true ;
389
}
390
391
#endif