mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
re-plug raddbg markup data section into module image info cache; fix detachment signifying
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ commands =
|
||||
{
|
||||
//- rjf: [raddbg]
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg meta telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build radbin debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- rjf: [raddbg wsl]
|
||||
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
+12
-10
@@ -3772,6 +3772,7 @@ ctrl_thread__module_open(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr_
|
||||
{
|
||||
Temp scratch = scratch_begin(0,0);
|
||||
|
||||
//- rjf: set up per-module info
|
||||
Arena *arena = arena_alloc();
|
||||
U64 entry_point_voff = 0;
|
||||
U32 rdi_dbg_time = 0;
|
||||
@@ -3779,22 +3780,20 @@ ctrl_thread__module_open(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr_
|
||||
String8 exe_dbg_path = {0};
|
||||
String8 rdi_dbg_path = {0};
|
||||
String8 raddbg_data = {0};
|
||||
Rng1U64 raddbg_section_voff_range = r1u64(0, 0);
|
||||
Rng1U64 raddbg_is_attached_section_voff_range = r1u64(0, 0);
|
||||
|
||||
Rng1U64 raddbg_section_voff_range = {0};
|
||||
Rng1U64 raddbg_is_attached_section_voff_range = {0};
|
||||
PE_IntelPdata *pdatas = 0;
|
||||
U64 pdatas_count = 0;
|
||||
U32 pdb_dbg_time = 0;
|
||||
U32 pdb_dbg_age = 0;
|
||||
Guid pdb_dbg_guid = {0};
|
||||
String8 pdb_dbg_path = {0};
|
||||
|
||||
U64 cfi_rebase = 0;
|
||||
B32 is_unwind_eh = 0;
|
||||
EH_FrameHdr eh_frame_hdr = {0};
|
||||
EH_PtrCtx eh_ptr_ctx = { .pc_vaddr = max_U64, .text_vaddr = max_U64, .data_vaddr = max_U64, .func_vaddr = max_U64, .ptr_align = 0 };
|
||||
|
||||
// read module's signature bytes
|
||||
//- read module's signature bytes
|
||||
U64 module_sig_size = Max(elf_magic_string.size, sizeof(PE_DosMagic));
|
||||
U8 *module_sig_bytes = push_array(scratch.arena, U8, module_sig_size);
|
||||
dmn_process_read(process.dmn_handle, rng_1u64(vaddr_range.min, vaddr_range.min + module_sig_size), module_sig_bytes);
|
||||
@@ -4004,6 +4003,7 @@ ctrl_thread__module_open(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- parse ELF module
|
||||
//
|
||||
@@ -4167,6 +4167,8 @@ ctrl_thread__module_open(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr_
|
||||
node->eh_ptr_ctx = eh_ptr_ctx;
|
||||
node->entry_point_voff = entry_point_voff;
|
||||
node->initial_debug_info_path = initial_debug_info_path;
|
||||
node->raddbg_attached_marker_voff = raddbg_is_attached_section_voff_range.min;
|
||||
node->raddbg_data = str8_copy(arena, raddbg_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4180,7 +4182,7 @@ ctrl_thread__module_close(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr
|
||||
//////////////////////////////
|
||||
//- rjf: evict module image info from cache
|
||||
//
|
||||
Rng1U64 raddbg_section_voff_range = {0};
|
||||
U64 raddbg_attached_marker_voff = 0;
|
||||
{
|
||||
U64 hash = ctrl_hash_from_handle(module);
|
||||
U64 slot_idx = hash%ctrl_state->module_image_info_cache.slots_count;
|
||||
@@ -4200,7 +4202,7 @@ ctrl_thread__module_close(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr
|
||||
}
|
||||
if(node)
|
||||
{
|
||||
raddbg_section_voff_range = node->raddbg_section_voff_range;
|
||||
raddbg_attached_marker_voff = node->raddbg_attached_marker_voff;
|
||||
DLLRemove(slot->first, slot->last, node);
|
||||
arena_release(node->arena);
|
||||
}
|
||||
@@ -4208,12 +4210,12 @@ ctrl_thread__module_close(CTRL_Handle process, CTRL_Handle module, Rng1U64 vaddr
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: write 0 into first byte of raddbg data section, to signify detachment
|
||||
//- rjf: write 0 at attachment market, to signify detachment
|
||||
//
|
||||
if(raddbg_section_voff_range.max != raddbg_section_voff_range.min)
|
||||
if(raddbg_attached_marker_voff != 0)
|
||||
{
|
||||
U8 new_value = 0;
|
||||
dmn_process_write_struct(process.dmn_handle, vaddr_range.min + raddbg_section_voff_range.min, &new_value);
|
||||
dmn_process_write_struct(process.dmn_handle, vaddr_range.min + raddbg_attached_marker_voff, &new_value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -634,7 +634,7 @@ struct CTRL_ModuleImageInfoCacheNode
|
||||
EH_PtrCtx eh_ptr_ctx;
|
||||
U64 entry_point_voff;
|
||||
String8 initial_debug_info_path;
|
||||
Rng1U64 raddbg_section_voff_range;
|
||||
U64 raddbg_attached_marker_voff;
|
||||
String8 raddbg_data;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user