#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <assert.h>
#include "musa/m68k.h"
#include "pd.h"
#include "md.h"
#include "system.h"
#include "debug.h"
#include "linenoise/linenoise.h"
Classes | |
class | md |
List of commands. More... |
Macros | |
#define | CURRENT_DEBUG_CONTEXT_NAME debug_context_names[debug_context] |
#define | REGID(id) { # id, M68K_REG_ ## id } |
#define | PRINT_Z80_FLAGS(x) |
#define | MAX_DISASM 128 |
Functions | |
void | completion (const char *buf, linenoiseCompletions *lc) |
Linenoise completion callback. | |
static int | debug_strtou32 (const char *str, uint32_t *ret) |
A simple wrapper around strtoul() with error check. | |
static int | debug_is_bp_set () |
Check if at least one breakpoint is set. | |
static int | debug_is_wp_set () |
Check if at least one watchpoint is set. | |
static int | debug_next_free_wp_m68k () |
Get the ID of the next free M68K watchpoint. | |
static int | debug_next_free_bp_m68k () |
Get the ID of the next free M68K breakpoint. | |
void | debug_init () |
Initialise the debugger. | |
static int | debug_find_bp_m68k (uint32_t addr) |
Find the index of a M68K breakpoint. | |
static int | debug_find_wp_m68k (uint32_t addr) |
Find the index of a M68K watchpoint by its start address. | |
static void | debug_m68k_bp_set_hit () |
Set a global flag to enter the debugger when hitting a breakpoint. | |
static void | debug_m68k_wp_set_hit () |
Set a global flag to enter the debugger when hitting a watchpoint. | |
static void | debug_print_hex_buf (unsigned char *buf, size_t len, size_t addr_label_start) |
Pretty prints hex dump. | |
static void | debug_print_wp (int idx) |
Print a watchpoint in a human-readable form. | |
static int | debug_should_wp_fire (struct dgen_wp *w) |
Check the given watchpoint against cached memory to see if it should fire. | |
int | debug_musa_callback () |
Breakpoint/watchpoint handler for Musashi, fired before every M68K instruction. | |
static void | debug_rm_bp_m68k (int index) |
Remove a M68K breakpoint. | |
static void | debug_rm_wp_m68k (int index) |
Remove a M68K watchpoint. | |
static void | debug_list_bps_m68k () |
Pretty print M68K breakpoints. | |
static void | debug_list_wps_m68k () |
Pretty print M68K watchpoints. | |
static int | debug_set_bp_m68k (uint32_t addr) |
Add a M68K breakpoint. | |
static int | debug_parse_cpu (char *arg) |
Convert a core name to a context ID. | |
uint32_t | m68k_read_disassembler_8 (unsigned int addr) |
uint32_t | m68k_read_disassembler_16 (unsigned int addr) |
uint32_t | m68k_read_disassembler_32 (unsigned int addr) |
Variables | |
struct dgen_bp | debug_bp_m68k [MAX_BREAKPOINTS] |
struct dgen_wp | debug_wp_m68k [MAX_WATCHPOINTS] |
int | debug_step_m68k |
unsigned int | debug_trace_m68k |
int | m68k_bp_hit = 0 |
int | m68k_wp_hit = 0 |
int | debug_context = DBG_CONTEXT_M68K |
const char * | debug_context_names [] |
const char * | psg_aliases [] = { "sn", "sn76489", "psg", NULL } |
Aliases for the various cores. | |
const char * | fm_aliases [] = { "fm", "ym", "ym2612", NULL } |
Aliases for YM2612 core. | |
const char * | z80_aliases [] = { "z80", "z", NULL} |
Aliases for Z80 core. | |
const char * | m68k_aliases [] = { "m68k", "m", "68000", "m68000", NULL} |
Aliases for M68K core. |
#define CURRENT_DEBUG_CONTEXT_NAME debug_context_names[debug_context] |
#define MAX_DISASM 128 |
#define PRINT_Z80_FLAGS | ( | x | ) |
void completion | ( | const char * | buf, |
linenoiseCompletions * | lc | ||
) |
Linenoise completion callback.
buf | String so far. |
lc | List of linenoise completions. |
|
static |
Find the index of a M68K breakpoint.
addr | Address to look for. |
|
static |
Find the index of a M68K watchpoint by its start address.
addr | Address to look for. |
void debug_init | ( | void | ) |
Initialise the debugger.
All breakpoints are disabled by default.
|
static |
Check if at least one breakpoint is set.
|
static |
Check if at least one watchpoint is set.
|
static |
Pretty print M68K breakpoints.
|
static |
Pretty print M68K watchpoints.
|
static |
Set a global flag to enter the debugger when hitting a breakpoint.
|
static |
Set a global flag to enter the debugger when hitting a watchpoint.
int debug_musa_callback | ( | void | ) |
Breakpoint/watchpoint handler for Musashi, fired before every M68K instruction.
|
static |
Get the ID of the next free M68K breakpoint.
|
static |
Get the ID of the next free M68K watchpoint.
|
static |
Convert a core name to a context ID.
[in] | arg | NUL-terminated core name. |
|
static |
Pretty prints hex dump.
[in] | buf | Buffer to pretty print. |
len | Number of bytes to print. | |
addr_label_start | The address of the first byte. |
|
static |
Print a watchpoint in a human-readable form.
idx | Index of watchpoint to print. |
|
static |
Remove a M68K breakpoint.
index | Index of breakpoint to remove. |
|
static |
Remove a M68K watchpoint.
index | Index of watchpoint to remove. |
|
static |
Add a M68K breakpoint.
addr | Address to break on. |
|
static |
Check the given watchpoint against cached memory to see if it should fire.
[in] | w | Watch point to check. |
|
static |
A simple wrapper around strtoul() with error check.
[in] | str | String to convert to number. |
[out] | ret | Number "str" represents. |
uint32_t m68k_read_disassembler_16 | ( | unsigned int | addr | ) |
uint32_t m68k_read_disassembler_32 | ( | unsigned int | addr | ) |
uint32_t m68k_read_disassembler_8 | ( | unsigned int | addr | ) |
Callbacks for Musashi.
struct dgen_bp debug_bp_m68k[MAX_BREAKPOINTS] |
int debug_context = DBG_CONTEXT_M68K |
const char* debug_context_names[] |
int debug_step_m68k |
unsigned int debug_trace_m68k |
struct dgen_wp debug_wp_m68k[MAX_WATCHPOINTS] |
const char* fm_aliases[] = { "fm", "ym", "ym2612", NULL } |
Aliases for YM2612 core.
const char* m68k_aliases[] = { "m68k", "m", "68000", "m68000", NULL} |
Aliases for M68K core.
int m68k_bp_hit = 0 |
int m68k_wp_hit = 0 |
const char* psg_aliases[] = { "sn", "sn76489", "psg", NULL } |
Aliases for the various cores.
Aliases for SN76489 core.
const char* z80_aliases[] = { "z80", "z", NULL} |
Aliases for Z80 core.