mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-18 18:12:23 -07:00
merge part 2
This commit is contained in:
@@ -47,6 +47,7 @@ enum
|
||||
typedef U16 COFF_MachineType;
|
||||
enum
|
||||
{
|
||||
// TODO(rjf): COFF_Machine prefix -> COFF_MachineType prefix
|
||||
COFF_Machine_Unknown = 0x0,
|
||||
COFF_Machine_X86 = 0x14c,
|
||||
COFF_Machine_X64 = 0x8664,
|
||||
|
||||
@@ -4639,9 +4639,11 @@ ctrl_thread__eval_scope_begin(Arena *arena, CTRL_Entity *thread)
|
||||
ctx->reg_space.u64_0 = (U64)thread;
|
||||
ctx->module_base = push_array(arena, U64, 1);
|
||||
ctx->module_base[0]= module->vaddr_range.min;
|
||||
ctx->frame_base = push_array(arena, U64, 1);
|
||||
// TODO(rjf): need to compute this out here somehow... ctx->frame_base[0] = ;
|
||||
ctx->tls_base = push_array(arena, U64, 1);
|
||||
}
|
||||
e_select_interpret_ctx(&scope->interpret_ctx);
|
||||
e_select_interpret_ctx(&scope->interpret_ctx, eval_modules_primary->rdi, thread_rip_voff);
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
@@ -469,9 +469,9 @@ dmn_w32_image_info_from_process_base_vaddr(HANDLE process, U64 base_vaddr)
|
||||
}
|
||||
|
||||
// rjf: get COFF header
|
||||
B32 got_file_header = 0;
|
||||
U64 file_header_off = 0;
|
||||
COFF_FileHeader file_header = {0};
|
||||
B32 got_coff_header = 0;
|
||||
U64 coff_header_off = 0;
|
||||
COFF_FileHeader coff_header = {0};
|
||||
if(pe_offset > 0)
|
||||
{
|
||||
U64 pe_magic_off = base_vaddr + pe_offset;
|
||||
@@ -479,21 +479,21 @@ dmn_w32_image_info_from_process_base_vaddr(HANDLE process, U64 base_vaddr)
|
||||
dmn_w32_process_read_struct(process, pe_magic_off, &pe_magic);
|
||||
if(pe_magic == PE_MAGIC)
|
||||
{
|
||||
file_header_off = pe_magic_off + sizeof(pe_magic);
|
||||
if(dmn_w32_process_read_struct(process, file_header_off, &file_header))
|
||||
coff_header_off = pe_magic_off + sizeof(pe_magic);
|
||||
if(dmn_w32_process_read_struct(process, coff_header_off, &coff_header))
|
||||
{
|
||||
got_file_header = 1;
|
||||
got_coff_header = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: get arch and size
|
||||
DMN_W32_ImageInfo result = zero_struct;
|
||||
if(got_file_header)
|
||||
if(got_coff_header)
|
||||
{
|
||||
U64 optional_size_off = 0;
|
||||
Arch arch = Arch_Null;
|
||||
switch(file_header.machine)
|
||||
switch(coff_header.machine)
|
||||
{
|
||||
case COFF_Machine_X86:
|
||||
{
|
||||
@@ -510,7 +510,7 @@ dmn_w32_image_info_from_process_base_vaddr(HANDLE process, U64 base_vaddr)
|
||||
}
|
||||
if(arch != Arch_Null)
|
||||
{
|
||||
U64 optional_off = file_header_off + sizeof(COFF_FileHeader);
|
||||
U64 optional_off = coff_header_off + sizeof(coff_header);
|
||||
U32 size = 0;
|
||||
if(dmn_w32_process_read_struct(process, optional_off+optional_size_off, &size) >= sizeof(size))
|
||||
{
|
||||
@@ -1251,7 +1251,7 @@ dmn_ctrl_launch(DMN_CtrlCtx *ctx, OS_ProcessLaunchParams *params)
|
||||
// rjf: get COFF header
|
||||
B32 got_coff_header = 0;
|
||||
U64 coff_header_off = 0;
|
||||
COFF_Header coff_header = {0};
|
||||
COFF_FileHeader coff_header = {0};
|
||||
if(pe_offset > 0)
|
||||
{
|
||||
U64 pe_magic_off = pe_offset;
|
||||
@@ -1274,13 +1274,13 @@ dmn_ctrl_launch(DMN_CtrlCtx *ctx, OS_ProcessLaunchParams *params)
|
||||
switch(coff_header.machine)
|
||||
{
|
||||
default:{}break;
|
||||
case COFF_MachineType_X64:
|
||||
case COFF_Machine_X64:
|
||||
{
|
||||
PE_OptionalHeader32Plus hdr = {0};
|
||||
os_file_read_struct(file, opt_header_off, &hdr);
|
||||
subsystem = hdr.subsystem;
|
||||
}break;
|
||||
case COFF_MachineType_X86:
|
||||
case COFF_Machine_X86:
|
||||
{
|
||||
PE_OptionalHeader32 hdr = {0};
|
||||
os_file_read_struct(file, opt_header_off, &hdr);
|
||||
|
||||
@@ -13923,7 +13923,7 @@ rd_frame(void)
|
||||
ctx->tls_base = push_array(scratch.arena, U64, 1);
|
||||
ctx->tls_base[0] = d_query_cached_tls_base_vaddr_from_process_root_rip(process, tls_root_vaddr, rip_vaddr);
|
||||
}
|
||||
e_select_interpret_ctx(interpret_ctx);
|
||||
e_select_interpret_ctx(interpret_ctx, eval_modules_primary->rdi, rip_voff);
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: build eval expand rule table
|
||||
|
||||
Reference in New Issue
Block a user