diff --git a/src/demon/win32/demon_core_win32.c b/src/demon/win32/demon_core_win32.c index da0984ae..2d39e0fe 100644 --- a/src/demon/win32/demon_core_win32.c +++ b/src/demon/win32/demon_core_win32.c @@ -1544,32 +1544,6 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) } } - ////////////////////////// - //- rjf: if run threads are marked as having reported an explicit trap - // on their last run, shift their RIPs past that trap instruction, so - // that they may continue - // - for(DMN_W32_EntityNode *n = first_run_thread; n != 0; n = n->next) - { - DMN_W32_Entity *thread = n->v; - if(thread->thread.last_run_reported_trap) - { - Temp temp = temp_begin(scratch.arena); - U64 regs_block_size = regs_block_size_from_architecture(thread->arch); - void *regs_block = push_array(temp.arena, U8, regs_block_size); - B32 good = dmn_w32_thread_read_reg_block(thread->arch, thread->handle, regs_block); - U64 pre_rip = regs_rip_from_arch_block(thread->arch, regs_block); - if(good && pre_rip == thread->thread.last_run_reported_trap_pre_rip) - { - regs_arch_block_write_rip(thread->arch, regs_block, thread->thread.last_run_reported_trap_post_rip); - dmn_w32_thread_write_reg_block(thread->arch, thread->handle, regs_block); - } - temp_end(temp); - thread->thread.last_run_reported_trap = 0; - thread->thread.last_run_reported_trap_post_rip = 0; - } - } - ////////////////////////// //- rjf: choose win32 resume code // @@ -2007,7 +1981,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) } //- rjf: determine whether to roll back instruction pointer - B32 should_do_rollback = (is_trap); + B32 should_do_rollback = (hit_user_trap); //- rjf: roll back thread's instruction pointer U64 post_trap_rip = 0; @@ -2044,14 +2018,6 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) e->flags = exception->ExceptionFlags; e->instruction_pointer = (U64)exception->ExceptionAddress; - // rjf: explicit trap -> mark this thread as having reported this trap - if(hit_explicit_trap) - { - thread->thread.last_run_reported_trap = 1; - thread->thread.last_run_reported_trap_pre_rip = instruction_pointer; - thread->thread.last_run_reported_trap_post_rip = post_trap_rip; - } - //- rjf: fill according to exception code switch(exception->ExceptionCode) { diff --git a/src/demon/win32/demon_core_win32.h b/src/demon/win32/demon_core_win32.h index 02dd05d1..285f86be 100644 --- a/src/demon/win32/demon_core_win32.h +++ b/src/demon/win32/demon_core_win32.h @@ -118,9 +118,6 @@ struct DMN_W32_Entity U64 thread_local_base; U64 last_name_hash; U64 name_gather_time_us; - B32 last_run_reported_trap; - U64 last_run_reported_trap_pre_rip; - U64 last_run_reported_trap_post_rip; } thread; struct diff --git a/src/mule/mule_main.cpp b/src/mule/mule_main.cpp index 4b56abf3..a9647a31 100644 --- a/src/mule/mule_main.cpp +++ b/src/mule/mule_main.cpp @@ -2280,6 +2280,10 @@ debug_string_tests(void) static void interrupt_stepping_tests(void) { + __debugbreak(); + __debugbreak(); + __debugbreak(); + __debugbreak(); for(int i = 0; i < 1000; i += 1) { if(i == 999) @@ -2297,6 +2301,19 @@ interrupt_stepping_tests(void) int x = 0; } +//////////////////////////////// +//~ rjf: JIT Stepping Tests + +static void +jit_stepping_tests(void) +{ + OutputDebugString("A\n"); + VOID *code = VirtualAlloc(0, 0x1000, MEM_COMMIT|MEM_RESERVE, PAGE_EXECUTE_READWRITE); + *((uint32_t*)code) = 0xC39090CC; + ((void (__fastcall *)()) code)(); + OutputDebugString("B\n"); +} + //////////////////////////////// // NOTE(allen): Exception Stepping @@ -2592,6 +2609,8 @@ mule_main(int argc, char** argv){ debug_string_tests(); + jit_stepping_tests(); + interrupt_stepping_tests(); exception_stepping_tests(); diff --git a/src/mule/mule_module.cpp b/src/mule/mule_module.cpp index c7dcec7e..6fd7170f 100644 --- a/src/mule/mule_module.cpp +++ b/src/mule/mule_module.cpp @@ -39,5 +39,4 @@ dll_type_eval_tests(void) Basics basics2 = {4, 5, 6, 7}; int x = 0; (void)x; - *(int *)0 = 0; }