mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-14 04:49:41 -07:00
lift wait-for-process-memory-cache-update out of d_process_write, since that path runs on control thread now too as the general 'process handle write' abstraction - just move into the rd_eval_space_write path, since that wait was only for UI benefit anyways
This commit is contained in:
1 parent
7a5ae846e9
commit
95f4ade10d
10 files changed
+177
-189
No files matched your search
@@ -121,72 +121,3 @@ dmn_event_list_push(Arena *arena, DMN_EventList *list)
|
||||
DMN_Event *result = &n->v;
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Thread Reading Helper Functions (Helpers, Implemented Once)
|
||||
|
||||
internal U64
|
||||
dmn_rip_from_thread(DMN_Handle thread)
|
||||
{
|
||||
U64 result = 0;
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
{
|
||||
Arch arch = dmn_arch_from_thread(thread);
|
||||
ARCH_Info *arch_info = arch_info_from_arch(arch);
|
||||
U64 reg_block_size = arch_info->reg_block_size;
|
||||
void *reg_block = push_array(scratch.arena, U8, reg_block_size);
|
||||
dmn_thread_read_reg_block(thread, reg_block);
|
||||
result = arch_ip_from_reg_block(arch_info, reg_block);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
dmn_rsp_from_thread(DMN_Handle thread)
|
||||
{
|
||||
U64 result = 0;
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
{
|
||||
Arch arch = dmn_arch_from_thread(thread);
|
||||
ARCH_Info *arch_info = arch_info_from_arch(arch);
|
||||
U64 reg_block_size = arch_info->reg_block_size;
|
||||
void *reg_block = push_array(scratch.arena, U8, reg_block_size);
|
||||
dmn_thread_read_reg_block(thread, reg_block);
|
||||
result = arch_sp_from_reg_block(arch_info, reg_block);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Process Reading Helper Functions (Helpers, Implemented Once)
|
||||
|
||||
internal String8
|
||||
dmn_get_trap_inst(void)
|
||||
{
|
||||
#if ARCH_X64
|
||||
local_persist U8 inst[] = { 0xcc };
|
||||
#else
|
||||
# error "trap instruction is not defined for this arch"
|
||||
#endif
|
||||
return str8_array_fixed(inst);
|
||||
}
|
||||
|
||||
internal DMN_ActiveTrap *
|
||||
dmn_set_trap(Arena *arena, DMN_Trap *trap)
|
||||
{
|
||||
String8 trap_inst = dmn_get_trap_inst();
|
||||
U8 *swap_bytes = push_array(arena, U8, trap_inst.size);
|
||||
B32 good_read = dmn_process_read(trap->process, r1u64(trap->vaddr, trap->vaddr + trap_inst.size), swap_bytes);
|
||||
B32 good_write = 0;
|
||||
if(good_read)
|
||||
{
|
||||
good_write = dmn_process_write(trap->process, r1u64(trap->vaddr, trap->vaddr + trap_inst.size), trap_inst.str);
|
||||
}
|
||||
DMN_ActiveTrap *result = push_array(arena, DMN_ActiveTrap, 1);
|
||||
result->good = (good_read && good_write);
|
||||
result->trap = trap;
|
||||
result->swap_bytes = str8(swap_bytes, trap_inst.size);
|
||||
return result;
|
||||
}
|
||||
@@ -152,15 +152,6 @@ struct DMN_TrapChunkList
|
||||
U64 trap_count;
|
||||
};
|
||||
|
||||
typedef struct DMN_ActiveTrap DMN_ActiveTrap;
|
||||
struct DMN_ActiveTrap
|
||||
{
|
||||
DMN_ActiveTrap *next;
|
||||
B32 good;
|
||||
DMN_Trap *trap;
|
||||
String8 swap_bytes;
|
||||
};
|
||||
|
||||
typedef struct DMN_RunCtrls DMN_RunCtrls;
|
||||
struct DMN_RunCtrls
|
||||
{
|
||||
@@ -210,12 +201,6 @@ internal DMN_HandleArray dmn_handle_array_copy(Arena *arena, DMN_HandleArray *sr
|
||||
//- rjf: event list building
|
||||
internal DMN_Event *dmn_event_list_push(Arena *arena, DMN_EventList *list);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Thread Reading Helper Functions (Helpers, Implemented Once)
|
||||
|
||||
internal U64 dmn_rip_from_thread(DMN_Handle thread);
|
||||
internal U64 dmn_rsp_from_thread(DMN_Handle thread);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Process Reading Helper Functions (Helpers, Implemented Once)
|
||||
|
||||
@@ -273,9 +258,4 @@ internal void dmn_process_iter_begin(DMN_ProcessIter *iter);
|
||||
internal B32 dmn_process_iter_next(Arena *arena, DMN_ProcessIter *iter, DMN_ProcessInfo *info_out);
|
||||
internal void dmn_process_iter_end(DMN_ProcessIter *iter);
|
||||
|
||||
//- arch trap
|
||||
internal String8 dmn_get_trap_inst(void);
|
||||
|
||||
internal DMN_ActiveTrap * dmn_set_trap(Arena *arena, DMN_Trap *trap);
|
||||
|
||||
#endif // DEMON_CORE_H
|
||||
Reference in new issue
Block a user