diff options
author | 2008-06-26 14:51:23 +0000 | |
---|---|---|
committer | 2008-06-26 14:51:23 +0000 | |
commit | 68f3a9ab9e20b3737b18e2034f5f5b5a2b016506 (patch) | |
tree | 99695c99728052fd906c54a69fccf1744769ab3a /src/emu/debugger.h | |
parent | 2f6f4aed589190b041704a2994689ffb7c03622e (diff) |
Removed DEBUGGER flag from makefile and ENABLE_DEBUGGER
macro from the source code. All MAME builds now include
the debugger, and it is enabled/disabled exclusively by
the runtime command-line/ini settings. This is a minor
speed hit for now, but will be further optimized going
forward.
Changed the 'd' suffix in the makefile to apply to DEBUG
builds (versus DEBUGGER builds as it did before).
Changed machine->debug_mode to machine->debug_flags.
These flags now indicate several things, such as whether
debugging is enabled, whether CPU cores should call the
debugger on each instruction, and whether there are live
watchpoints on each address space.
Redesigned a significant portion of debugcpu.c around
the concept of maintaining these flags globally and a
similar, more complete set of flags internally for each
CPU. All previous functionality should work as designed
but should be more robust and faster to work with.
Added new debugger hooks for starting/stopping CPU
execution. This allows the debugger to decide whether
or not a given CPU needs to call the debugger on each
instruction during the coming timeslice.
Added new debugger hook for reporting exceptions.
Proper exception breakpoints are not yet implemented.
Added new module debugger.c which is where global
debugger functions live.
Diffstat (limited to 'src/emu/debugger.h')
-rw-r--r-- | src/emu/debugger.h | 109 |
1 files changed, 69 insertions, 40 deletions
diff --git a/src/emu/debugger.h b/src/emu/debugger.h index 513c6eb613f..fed1da3b997 100644 --- a/src/emu/debugger.h +++ b/src/emu/debugger.h @@ -15,61 +15,90 @@ #define __DEBUGGER_H__ #include "mame.h" -#include "memory.h" -#ifdef ENABLE_DEBUGGER #include "deprecat.h" -#endif - - -/*************************************************************************** - MACROS -***************************************************************************/ - -/* handy macro for hard-coding debugger breaks */ -#ifdef ENABLE_DEBUGGER -#define DEBUGGER_BREAK if (Machine->debug_mode) mame_debug_break(); -#else -#define DEBUGGER_BREAK -#endif - - -/* handy macro for CPU cores */ -#ifdef ENABLE_DEBUGGER -#define CALL_DEBUGGER(p) if (Machine->debug_mode) mame_debug_hook(p); -#else -#define CALL_DEBUGGER(p) -#endif - +#include "debug/debugcpu.h" /*************************************************************************** FUNCTION PROTOTYPES ***************************************************************************/ -/* initialize the debugger */ -void mame_debug_init(running_machine *machine); +/* ----- core debugger functions ----- */ -/* call this once per instruction from CPU cores */ -void mame_debug_hook(offs_t curpc); - -/* call this to break into the debugger as soon as possible */ -void mame_debug_break(void); +/* initialize the debugger */ +void debugger_init(running_machine *machine); -/* call this to determine if the debugger is currently active (broken) */ -int mame_debug_is_active(void); +/* redraw the current video display */ +void debugger_refresh_display(running_machine *machine); /*************************************************************************** - STUBS + INLINE FUNCTIONS ***************************************************************************/ -#ifndef ENABLE_DEBUGGER -#define mame_debug_init(m) do { } while (0) -#define mame_debug_hook() do { } while (0) -#define mame_debug_break() do { } while (0) -#define mame_debug_is_active() FALSE -#endif +/*------------------------------------------------- + debugger_instruction_hook - CPU cores call + this once per instruction from CPU cores +-------------------------------------------------*/ + +INLINE void debugger_instruction_hook(running_machine *machine, offs_t curpc) +{ + if ((machine->debug_flags & DEBUG_FLAG_CALL_HOOK) != 0) + debug_cpu_instruction_hook(machine, curpc); +} + + +/*------------------------------------------------- + debugger_start_cpu_hook - the CPU execution + system calls this hook before beginning + execution for the given CPU +-------------------------------------------------*/ + +INLINE void debugger_start_cpu_hook(running_machine *machine, int cpunum, attotime endtime) +{ + if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + debug_cpu_start_hook(machine, cpunum, endtime); +} + + +/*------------------------------------------------- + debugger_stop_cpu_hook - the CPU execution + system calls this hook when ending execution + for the given CPU +-------------------------------------------------*/ + +INLINE void debugger_stop_cpu_hook(running_machine *machine, int cpunum) +{ + if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + debug_cpu_stop_hook(machine, cpunum); +} + + +/*------------------------------------------------- + debugger_break - stop in the debugger at the + next opportunity +-------------------------------------------------*/ + +INLINE void debugger_break(running_machine *machine) +{ + if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + debug_cpu_halt_on_next_instruction(machine); +} + + +/*------------------------------------------------- + debugger_within_instruction_hook - call this + to determine if the debugger is currently + halted within the instruction hook +-------------------------------------------------*/ + +INLINE int debugger_within_instruction_hook(running_machine *machine) +{ + if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) + return debug_cpu_within_instruction_hook(machine); + return FALSE; +} #endif /* __DEBUGGER_H__ */ |