mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-15 05:51:26 -07:00
begin porting unwinder to ctrl layer, just built purely on in-process memory, and getting completely off of parsed binary image artifacts
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -107,6 +107,15 @@ struct CTRL_EntityStore
|
||||
////////////////////////////////
|
||||
//~ rjf: Unwind Types
|
||||
|
||||
typedef struct CTRL_UnwindStepResult CTRL_UnwindStepResult;
|
||||
struct CTRL_UnwindStepResult
|
||||
{
|
||||
B32 dead;
|
||||
B32 missed_read;
|
||||
U64 missed_read_addr;
|
||||
U64 stack_pointer;
|
||||
};
|
||||
|
||||
typedef struct CTRL_UnwindFrame CTRL_UnwindFrame;
|
||||
struct CTRL_UnwindFrame
|
||||
{
|
||||
@@ -654,6 +663,8 @@ internal U128 ctrl_hash_store_key_from_process_vaddr_range(CTRL_MachineID machin
|
||||
//- rjf: process memory cache reading helpers
|
||||
internal CTRL_ProcessMemorySlice ctrl_query_cached_data_from_process_vaddr_range(Arena *arena, CTRL_MachineID machine_id, DMN_Handle process, Rng1U64 range, U64 endt_us);
|
||||
internal CTRL_ProcessMemorySlice ctrl_query_cached_zero_terminated_data_from_process_vaddr_limit(Arena *arena, CTRL_MachineID machine_id, DMN_Handle process, U64 vaddr, U64 limit, U64 element_size, U64 endt_us);
|
||||
internal B32 ctrl_read_cached_process_memory(CTRL_MachineID machine_id, DMN_Handle process, Rng1U64 range, B32 *is_stale_out, void *out, U64 endt_us);
|
||||
#define ctrl_read_cached_process_memory_struct(machine_id, process, vaddr, is_stale_out, ptr, endt_us) ctrl_read_cached_process_memory((machine_id), (process), r1u64((vaddr), (vaddr)+(sizeof(*(ptr)))), (is_stale_out), (ptr), (endt_us))
|
||||
|
||||
//- rjf: process memory writing
|
||||
internal B32 ctrl_process_write(CTRL_MachineID machine_id, DMN_Handle process, Rng1U64 range, void *src);
|
||||
@@ -672,6 +683,14 @@ internal B32 ctrl_thread_write_reg_block(CTRL_MachineID machine_id, DMN_Handle t
|
||||
////////////////////////////////
|
||||
//~ rjf: Unwinding Functions
|
||||
|
||||
//- rjf: [x64]
|
||||
internal REGS_Reg64 *ctrl_unwind_reg_from_pe_gpr_reg__pe_x64(REGS_RegBlockX64 *regs, PE_UnwindGprRegX64 gpr_reg);
|
||||
internal CTRL_UnwindStepResult ctrl_unwind_step__pe_x64(CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle module, REGS_RegBlockX64 *regs, U64 endt_us);
|
||||
|
||||
//- rjf: abstracted unwind step
|
||||
internal CTRL_UnwindStepResult ctrl_unwind_step(CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle module, Architecture arch, void *reg_block, U64 endt_us);
|
||||
|
||||
//- rjf: abstracted full unwind
|
||||
internal CTRL_Unwind ctrl_unwind_from_thread(Arena *arena, CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle thread, U64 endt_us);
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -6474,7 +6474,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
{
|
||||
ui_label(full_path);
|
||||
ui_spacer(ui_em(1.5f, 1));
|
||||
ui_labelf("Row: %I64d, Col: %I64d", tv->cursor.line, tv->cursor.column);
|
||||
ui_labelf("Line: %I64d, Col: %I64d", tv->cursor.line, tv->cursor.column);
|
||||
ui_spacer(ui_pct(1, 0));
|
||||
ui_labelf("(read only)");
|
||||
ui_labelf("%s",
|
||||
@@ -7326,7 +7326,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
U64 cursor_vaddr = (1 <= dv->cursor.line && dv->cursor.line <= dasm_info.insts.count) ? (dasm_vaddr_range.min+dasm_info.insts.v[dv->cursor.line-1].code_off) : 0;
|
||||
ui_labelf("%S", path_normalized_from_string(scratch.arena, module->name));
|
||||
ui_spacer(ui_em(1.5f, 1));
|
||||
ui_labelf("Address: 0x%I64x, Row: %I64d, Col: %I64d", cursor_vaddr, dv->cursor.line, dv->cursor.column);
|
||||
ui_labelf("Address: 0x%I64x, Line: %I64d, Col: %I64d", cursor_vaddr, dv->cursor.line, dv->cursor.column);
|
||||
ui_spacer(ui_pct(1, 0));
|
||||
ui_labelf("(read only)");
|
||||
ui_labelf("bin");
|
||||
@@ -8120,7 +8120,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText))
|
||||
UI_Font(code_font)
|
||||
{
|
||||
ui_labelf("Row: %I64d, Col: %I64d", tv->cursor.line, tv->cursor.column);
|
||||
ui_labelf("Line: %I64d, Col: %I64d", tv->cursor.line, tv->cursor.column);
|
||||
ui_spacer(ui_pct(1, 0));
|
||||
ui_labelf("(read only)");
|
||||
}
|
||||
|
||||
+2
-3
@@ -69,11 +69,10 @@ pe_bin_info_from_data(Arena *arena, String8 data)
|
||||
}
|
||||
|
||||
// rjf: read pe magic
|
||||
U32 coff_off = dos_header.coff_file_offset;
|
||||
U32 pe_magic = 0;
|
||||
if(valid)
|
||||
{
|
||||
str8_deserial_read_struct(data, coff_off, &pe_magic);
|
||||
str8_deserial_read_struct(data, dos_header.coff_file_offset, &pe_magic);
|
||||
}
|
||||
|
||||
// rjf: bad pe magic -> abort
|
||||
@@ -83,7 +82,7 @@ pe_bin_info_from_data(Arena *arena, String8 data)
|
||||
}
|
||||
|
||||
// rjf: read coff header
|
||||
U32 coff_header_off = coff_off + sizeof(pe_magic);
|
||||
U32 coff_header_off = dos_header.coff_file_offset + sizeof(pe_magic);
|
||||
COFF_Header coff_header = {0};
|
||||
if(valid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user