Files
nunuhara_xsystem4/include/debugger.h
T
Nunuhara Cabbage 1a0a0e0c12 debugger: breakpoints
This is implemented by inserting special opcodes into the game's code.
When the breakpoint handler is finished, it returns the original opcode
so that execute_instruction can continue executing normally.

E.g.

* start xsystem4 with --debug option to drop into debugger immediately
* run (bp "game_main")
* ^d or \exit to close debugger REPL
* ...drop into a debugger REPL again at the game_main function
2020-08-09 12:41:33 -07:00

34 lines
1.0 KiB
C

/* Copyright (C) 2019 Nunuhara Cabbage <nunuhara@haniwa.technology>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://gnu.org/licenses/>.
*/
#ifndef SYSTEM4_DEBUGGER_H
#define SYSTEM4_DEBUGGER_H
#ifdef DEBUGGER_ENABLED
#include <stdbool.h>
#include "system4/instructions.h"
bool dbg_enabled;
void dbg_init(void);
void dbg_fini(void);
void dbg_repl(void);
enum opcode dbg_handle_breakpoint(unsigned bp_no);
#endif /* DEBUGGER_ENABLED */
#endif /* SYSTEM4_DEBUGGER_H */