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/cpu/drcbex64.c | |
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/cpu/drcbex64.c')
-rw-r--r-- | src/emu/cpu/drcbex64.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index 1d24a46ab50..ddaccadc70f 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -273,7 +273,7 @@ struct _drcbe_state x86code * exit; /* exit point */ x86code * nocode; /* nocode handler */ - x86code * mame_debug_hook; /* debugger callback */ + x86code * debug_cpu_instruction_hook;/* debugger callback */ x86code * debug_log_hashjmp; /* hashjmp debugging */ x86code * drcmap_get_value; /* map lookup helper */ data_accessors accessors[ADDRESS_SPACES];/* memory accessors */ @@ -713,9 +713,7 @@ static drcbe_state *drcbex64_alloc(drcuml_state *drcuml, drccache *cache, UINT32 drcbe->absmask64[0] = drcbe->absmask64[1] = U64(0x7fffffffffffffff); /* get pointers to C functions we need to call */ -#ifdef ENABLE_DEBUGGER - drcbe->mame_debug_hook = (x86code *)mame_debug_hook; -#endif + drcbe->debug_cpu_instruction_hook = (x86code *)debug_cpu_instruction_hook; #if LOG_HASHJMPS drcbe->debug_log_hashjmp = (x86code *)debug_log_hashjmp; #endif @@ -3083,24 +3081,32 @@ static x86code *op_nop(drcbe_state *drcbe, x86code *dst, const drcuml_instructio static x86code *op_debug(drcbe_state *drcbe, x86code *dst, const drcuml_instruction *inst) { + emit_link skip = { 0 }; + /* validate instruction */ assert(inst->size == 4); assert_no_condition(inst); assert_no_flags(inst); -#ifdef ENABLE_DEBUGGER - if (Machine->debug_mode) + if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0) { drcuml_parameter pcp; /* normalize parameters */ param_normalize_1(drcbe, inst, &pcp, PTYPE_MRI); + /* test and branch */ + emit_mov_r64_imm(&dst, REG_PARAM1, (FPTR)Machine); // mov param1,pcp + emit_test_m32_imm(&dst, MBD(REG_PARAM1, offsetof(running_machine, debug_flags)), DEBUG_FLAG_CALL_HOOK); + // test [Machine->debug_flags],DEBUG_FLAG_CALL_HOOK + emit_jcc_short_link(&dst, COND_Z, &skip); // jz skip + /* push the parameter */ - emit_mov_r32_p32(drcbe, &dst, REG_PARAM1, &pcp); // mov param1,pcp - emit_smart_call_m64(drcbe, &dst, &drcbe->mame_debug_hook); // call mame_debug_hook + emit_mov_r32_p32(drcbe, &dst, REG_PARAM2, &pcp); // mov param1,pcp + emit_smart_call_m64(drcbe, &dst, &drcbe->debug_cpu_instruction_hook); // call debug_cpu_instruction_hook + + resolve_link(&dst, &skip); // skip: } -#endif return dst; } |