git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

Core/debugger.h

      1 #pragma once
      2 #ifndef GB_DISABLE_DEBUGGER
      3 #include <stdbool.h>
      4 #include <stdint.h>
      5 #include "defs.h"
      6 #include "symbol_hash.h"
      7 
      8 typedef void (*GB_debugger_reload_callback_t)(GB_gameboy_t *gb);
      9 
     10 void GB_debugger_break(GB_gameboy_t *gb);
     11 #ifdef GB_INTERNAL
     12 bool /* Returns true if debugger waits for more commands. Not relevant for non-GB_INTERNAL */
     13 #else
     14 void
     15 #endif
     16 GB_debugger_execute_command(GB_gameboy_t *gb, char *input); /* Destroys input. */
     17 char *GB_debugger_complete_substring(GB_gameboy_t *gb, char *input, uintptr_t *context);  /* Destroys input, result requires free */
     18 void GB_debugger_load_symbol_file(GB_gameboy_t *gb, const char *path);
     19 const char *GB_debugger_name_for_address(GB_gameboy_t *gb, uint16_t addr);
     20 /* Use -1 for bank to use the currently mapped bank */
     21 const char *GB_debugger_describe_address(GB_gameboy_t *gb, uint16_t addr, uint16_t bank, bool exact_match, bool prefer_local);
     22 bool GB_debugger_evaluate(GB_gameboy_t *gb, const char *string, uint16_t *result, uint16_t *result_bank); /* result_bank is -1 if unused. */
     23 bool GB_debugger_is_stopped(GB_gameboy_t *gb);
     24 void GB_debugger_set_disabled(GB_gameboy_t *gb, bool disabled);
     25 void GB_debugger_clear_symbols(GB_gameboy_t *gb);
     26 void GB_debugger_set_reload_callback(GB_gameboy_t *gb, GB_debugger_reload_callback_t callback);
     27 
     28 double GB_debugger_get_frame_cpu_usage(GB_gameboy_t *gb);
     29 double GB_debugger_get_second_cpu_usage(GB_gameboy_t *gb);
     30 
     31 #ifdef GB_INTERNAL
     32 internal void GB_debugger_run(GB_gameboy_t *gb);
     33 internal void GB_debugger_handle_async_commands(GB_gameboy_t *gb);
     34 internal void GB_debugger_call_hook(GB_gameboy_t *gb, uint16_t call_addr);
     35 internal void GB_debugger_ret_hook(GB_gameboy_t *gb);
     36 internal void GB_debugger_test_write_watchpoint(GB_gameboy_t *gb, uint16_t addr, uint8_t value);
     37 internal void GB_debugger_test_read_watchpoint(GB_gameboy_t *gb, uint16_t addr);
     38 internal const GB_bank_symbol_t *GB_debugger_find_symbol(GB_gameboy_t *gb, uint16_t addr, bool prefer_local);
     39 internal void GB_debugger_add_symbol(GB_gameboy_t *gb, uint16_t bank, uint16_t address, const char *symbol);
     40 #ifndef GB_DISABLE_CHEAT_SEARCH
     41 internal bool GB_debugger_evaluate_cheat_filter(GB_gameboy_t *gb, const char *string, bool *result, uint16_t old, uint16_t new);
     42 #endif
     43 #endif
     44 
     45 #else // GB_DISABLE_DEBUGGER
     46 #ifdef GB_INTERNAL
     47 #define GB_debugger_run(gb) (void)0
     48 #define GB_debugger_handle_async_commands(gb) (void)0
     49 #define GB_debugger_ret_hook(gb) (void)0
     50 #define GB_debugger_call_hook(gb, addr) (void)addr
     51 #define GB_debugger_test_write_watchpoint(gb, addr, value) ((void)addr, (void)value)
     52 #define GB_debugger_test_read_watchpoint(gb, addr) (void)addr
     53 #define GB_debugger_add_symbol(gb, bank, address, symbol) ((void)bank, (void)address, (void)symbol)
     54 #define GB_debugger_break(gb) (void)0
     55 #endif // GB_INTERNAL
     56 
     57 #endif // GB_DISABLE_DEBUGGER

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.