comparison m68k_core.h @ 2396:bf4f1a8d1d48

Implement 68K watchpoints in internal debugger
author Michael Pavone <pavone@retrodev.com>
date Sat, 23 Dec 2023 17:37:57 -0800
parents 1b4ddca07640
children
comparison
equal deleted inserted replaced
2395:ebca8ab02701 2396:bf4f1a8d1d48
78 typedef struct { 78 typedef struct {
79 m68k_debug_handler handler; 79 m68k_debug_handler handler;
80 uint32_t address; 80 uint32_t address;
81 } m68k_breakpoint; 81 } m68k_breakpoint;
82 82
83 typedef struct {
84 uint32_t start;
85 uint32_t end;
86 uint8_t check_change;
87 } m68k_watchpoint;
88
83 #ifdef X86_64 89 #ifdef X86_64
84 #define M68K_STACK_STORAGE 12 90 #define M68K_STACK_STORAGE 12
85 #else 91 #else
86 #define M68K_STACK_STORAGE 20 92 #define M68K_STACK_STORAGE 20
87 #endif 93 #endif
107 void *host_sp_entry; 113 void *host_sp_entry;
108 void *stack_storage[M68K_STACK_STORAGE]; 114 void *stack_storage[M68K_STACK_STORAGE];
109 m68k_breakpoint *breakpoints; 115 m68k_breakpoint *breakpoints;
110 uint32_t num_breakpoints; 116 uint32_t num_breakpoints;
111 uint32_t bp_storage; 117 uint32_t bp_storage;
118 uint32_t watchpoint_min;
119 uint32_t watchpoint_max;
120 m68k_watchpoint *watchpoints;
121 uint32_t num_watchpoints;
122 uint32_t wp_storage;
123 uint32_t wp_hit_address;
124 uint16_t wp_hit_value;
125 uint16_t wp_old_value;
126 uint8_t wp_hit;
112 uint8_t int_pending; 127 uint8_t int_pending;
113 uint8_t trace_pending; 128 uint8_t trace_pending;
114 uint8_t should_return; 129 uint8_t should_return;
115 uint8_t stack_storage_count; 130 uint8_t stack_storage_count;
116 uint8_t ram_code_flags[]; 131 uint8_t ram_code_flags[];
126 m68k_context * init_68k_context(m68k_options * opts, m68k_reset_handler reset_handler); 141 m68k_context * init_68k_context(m68k_options * opts, m68k_reset_handler reset_handler);
127 void m68k_reset(m68k_context * context); 142 void m68k_reset(m68k_context * context);
128 void m68k_options_free(m68k_options *opts); 143 void m68k_options_free(m68k_options *opts);
129 void insert_breakpoint(m68k_context * context, uint32_t address, m68k_debug_handler bp_handler); 144 void insert_breakpoint(m68k_context * context, uint32_t address, m68k_debug_handler bp_handler);
130 void remove_breakpoint(m68k_context * context, uint32_t address); 145 void remove_breakpoint(m68k_context * context, uint32_t address);
146 void m68k_add_watchpoint(m68k_context *context, uint32_t address, uint32_t size);
147 void m68k_remove_watchpoint(m68k_context *context, uint32_t address, uint32_t size);
131 m68k_context * m68k_handle_code_write(uint32_t address, m68k_context * context); 148 m68k_context * m68k_handle_code_write(uint32_t address, m68k_context * context);
132 uint32_t get_instruction_start(m68k_options *opts, uint32_t address); 149 uint32_t get_instruction_start(m68k_options *opts, uint32_t address);
133 uint16_t m68k_get_ir(m68k_context *context); 150 uint16_t m68k_get_ir(m68k_context *context);
134 void m68k_print_regs(m68k_context * context); 151 void m68k_print_regs(m68k_context * context);
135 void m68k_invalidate_code_range(m68k_context *context, uint32_t start, uint32_t end); 152 void m68k_invalidate_code_range(m68k_context *context, uint32_t start, uint32_t end);