mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
Merge tag 'v0.9.15-alpha'
This commit is contained in:
@@ -108,7 +108,7 @@ pushd build
|
|||||||
if "%raddbg%"=="1" set didbuild=1 && %compile% ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg.exe || exit /b 1
|
if "%raddbg%"=="1" set didbuild=1 && %compile% ..\src\raddbg\raddbg_main.c %compile_link% %link_icon% %out%raddbg.exe || exit /b 1
|
||||||
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %link_natvis%"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
|
if "%radlink%"=="1" set didbuild=1 && %compile% ..\src\linker\lnk.c %compile_link% %link_natvis%"%~dp0\src\linker\linker.natvis" %out%radlink.exe || exit /b 1
|
||||||
if "%raddump%"=="1" set didbuild=1 && %compile% ..\src\raddump\raddump_main.c %compile_link% %out%raddump.exe || exit /b 1
|
if "%raddump%"=="1" set didbuild=1 && %compile% ..\src\raddump\raddump_main.c %compile_link% %out%raddump.exe || exit /b 1
|
||||||
if "%rdi_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_pdb\rdi_from_pdb_main.c %compile_link% %out%rdi_from_pdb.exe || exit /b 2
|
if "%rdi_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_pdb\rdi_from_pdb_main.c %compile_link% %out%rdi_from_pdb.exe || exit /b 1
|
||||||
if "%rdi_from_dwarf%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_dwarf\rdi_from_dwarf.c %compile_link% %out%rdi_from_dwarf.exe || exit /b 1
|
if "%rdi_from_dwarf%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_dwarf\rdi_from_dwarf.c %compile_link% %out%rdi_from_dwarf.exe || exit /b 1
|
||||||
if "%rdi_dump%"=="1" set didbuild=1 && %compile% ..\src\rdi_dump\rdi_dump_main.c %compile_link% %out%rdi_dump.exe || exit /b 1
|
if "%rdi_dump%"=="1" set didbuild=1 && %compile% ..\src\rdi_dump\rdi_dump_main.c %compile_link% %out%rdi_dump.exe || exit /b 1
|
||||||
if "%rdi_breakpad_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_breakpad_from_pdb\rdi_breakpad_from_pdb_main.c %compile_link% %out%rdi_breakpad_from_pdb.exe || exit /b 1
|
if "%rdi_breakpad_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_breakpad_from_pdb\rdi_breakpad_from_pdb_main.c %compile_link% %out%rdi_breakpad_from_pdb.exe || exit /b 1
|
||||||
|
|||||||
@@ -159,7 +159,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(BUILD_VERSION_PATCH)
|
#if !defined(BUILD_VERSION_PATCH)
|
||||||
# define BUILD_VERSION_PATCH 14
|
# define BUILD_VERSION_PATCH 15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BUILD_VERSION_STRING_LITERAL Stringify(BUILD_VERSION_MAJOR) "." Stringify(BUILD_VERSION_MINOR) "." Stringify(BUILD_VERSION_PATCH)
|
#define BUILD_VERSION_STRING_LITERAL Stringify(BUILD_VERSION_MAJOR) "." Stringify(BUILD_VERSION_MINOR) "." Stringify(BUILD_VERSION_PATCH)
|
||||||
|
|||||||
@@ -214,6 +214,35 @@ coff_string_from_section_flags(Arena *arena, COFF_SectionFlags flags)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal String8
|
||||||
|
coff_string_from_resource_memory_flags(Arena *arena, COFF_ResourceMemoryFlags flags)
|
||||||
|
{
|
||||||
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
|
String8List list = {0};
|
||||||
|
|
||||||
|
if (flags & COFF_ResourceMemoryFlag_Moveable) {
|
||||||
|
flags &= COFF_ResourceMemoryFlag_Moveable;
|
||||||
|
str8_list_pushf(scratch.arena, &list, "Moveable");
|
||||||
|
}
|
||||||
|
if (flags & COFF_ResourceMemoryFlag_Pure) {
|
||||||
|
flags &= COFF_ResourceMemoryFlag_Pure;
|
||||||
|
str8_list_pushf(scratch.arena, &list, "Pure");
|
||||||
|
}
|
||||||
|
if (flags & COFF_ResourceMemoryFlag_Discardable) {
|
||||||
|
flags &= COFF_ResourceMemoryFlag_Discardable;
|
||||||
|
str8_list_pushf(scratch.arena, &list, "Discardable");
|
||||||
|
}
|
||||||
|
if (flags != 0) {
|
||||||
|
str8_list_pushf(scratch.arena, &list, "%#x", flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
String8 result = str8_list_join(arena, &list, &(StringJoin){.sep=str8_lit(", ")});
|
||||||
|
|
||||||
|
scratch_end(scratch);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
internal String8
|
internal String8
|
||||||
coff_string_from_import_header_type(COFF_ImportType type)
|
coff_string_from_import_header_type(COFF_ImportType type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ internal String8 coff_string_from_comdat_select_type(COFF_ComdatSelectType type)
|
|||||||
internal String8 coff_string_from_machine_type(COFF_MachineType machine);
|
internal String8 coff_string_from_machine_type(COFF_MachineType machine);
|
||||||
internal String8 coff_string_from_flags(Arena *arena, COFF_FileHeaderFlags flags);
|
internal String8 coff_string_from_flags(Arena *arena, COFF_FileHeaderFlags flags);
|
||||||
internal String8 coff_string_from_section_flags(Arena *arena, COFF_SectionFlags flags);
|
internal String8 coff_string_from_section_flags(Arena *arena, COFF_SectionFlags flags);
|
||||||
|
internal String8 coff_string_from_resource_memory_flags(Arena *arena, COFF_ResourceMemoryFlags flags);
|
||||||
internal String8 coff_string_from_import_header_type(COFF_ImportType type);
|
internal String8 coff_string_from_import_header_type(COFF_ImportType type);
|
||||||
internal String8 coff_string_from_sym_dtype(COFF_SymDType x);
|
internal String8 coff_string_from_sym_dtype(COFF_SymDType x);
|
||||||
internal String8 coff_string_from_sym_type(COFF_SymType x);
|
internal String8 coff_string_from_sym_type(COFF_SymType x);
|
||||||
|
|||||||
+17
-17
@@ -8,9 +8,9 @@ coff_is_big_obj(String8 raw_coff)
|
|||||||
if (raw_coff.size >= sizeof(COFF_BigObjHeader)) {
|
if (raw_coff.size >= sizeof(COFF_BigObjHeader)) {
|
||||||
COFF_BigObjHeader *file_header32 = (COFF_BigObjHeader*)(raw_coff.str);
|
COFF_BigObjHeader *file_header32 = (COFF_BigObjHeader*)(raw_coff.str);
|
||||||
is_big_obj = file_header32->sig1 == COFF_Machine_Unknown &&
|
is_big_obj = file_header32->sig1 == COFF_Machine_Unknown &&
|
||||||
file_header32->sig2 == max_U16 &&
|
file_header32->sig2 == max_U16 &&
|
||||||
file_header32->version >= 2 &&
|
file_header32->version >= 2 &&
|
||||||
MemoryCompare(file_header32->magic, g_coff_big_header_magic, sizeof(file_header32->magic)) == 0;
|
MemoryCompare(file_header32->magic, g_coff_big_header_magic, sizeof(file_header32->magic)) == 0;
|
||||||
}
|
}
|
||||||
return is_big_obj;
|
return is_big_obj;
|
||||||
}
|
}
|
||||||
@@ -411,14 +411,14 @@ coff_write_resource_id(Arena *arena, COFF_ResourceID id)
|
|||||||
{
|
{
|
||||||
String8 result = str8_zero();
|
String8 result = str8_zero();
|
||||||
switch (id.type) {
|
switch (id.type) {
|
||||||
case COFF_ResourceIDType_Null: break;
|
case COFF_ResourceIDType_Null: break;
|
||||||
case COFF_ResourceIDType_Number: {
|
case COFF_ResourceIDType_Number: {
|
||||||
result = coff_resource_number_from_u16(arena, id.u.number);
|
result = coff_resource_number_from_u16(arena, id.u.number);
|
||||||
} break;
|
} break;
|
||||||
case COFF_ResourceIDType_String: {
|
case COFF_ResourceIDType_String: {
|
||||||
result = coff_resource_string_from_str8(arena, id.u.string);
|
result = coff_resource_string_from_str8(arena, id.u.string);
|
||||||
} break;
|
} break;
|
||||||
default: InvalidPath;
|
default: InvalidPath;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -476,13 +476,13 @@ coff_write_resource(Arena *arena,
|
|||||||
internal int
|
internal int
|
||||||
coff_resource_id_compar(void *raw_a, void *raw_b)
|
coff_resource_id_compar(void *raw_a, void *raw_b)
|
||||||
{
|
{
|
||||||
int cmp;
|
int cmp = 0;
|
||||||
COFF_ResourceID *a = raw_b;
|
COFF_ResourceID *a = raw_a;
|
||||||
COFF_ResourceID *b = raw_b;
|
COFF_ResourceID *b = raw_b;
|
||||||
if (a->type == b->type) {
|
if (a->type == b->type) {
|
||||||
switch (a->type) {
|
switch (a->type) {
|
||||||
case COFF_ResourceIDType_Null: cmp = 0; break;
|
case COFF_ResourceIDType_Null: cmp = 0; break;
|
||||||
case COFF_ResourceIDType_Number: cmp = a->u.number < b->u.number ? -1 : a->u.number > b->u.number ? +1 : 0; break;
|
case COFF_ResourceIDType_Number: cmp = MemoryCompare(&a->u.number, &b->u.number, sizeof(a->u.number)); break;
|
||||||
case COFF_ResourceIDType_String: cmp = strncmp((char *)a->u.string.str, (char *)b->u.string.str, Min(a->u.string.size, b->u.string.size)); break;
|
case COFF_ResourceIDType_String: cmp = strncmp((char *)a->u.string.str, (char *)b->u.string.str, Min(a->u.string.size, b->u.string.size)); break;
|
||||||
default: InvalidPath; break;
|
default: InvalidPath; break;
|
||||||
}
|
}
|
||||||
@@ -894,9 +894,9 @@ coff_archive_parse_from_data(String8 raw_archive)
|
|||||||
{
|
{
|
||||||
COFF_ArchiveType type = coff_archive_type_from_data(raw_archive);
|
COFF_ArchiveType type = coff_archive_type_from_data(raw_archive);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case COFF_Archive_Null: break;
|
case COFF_Archive_Null: break;
|
||||||
case COFF_Archive_Regular: return coff_regular_archive_parse_from_data(raw_archive);
|
case COFF_Archive_Regular: return coff_regular_archive_parse_from_data(raw_archive);
|
||||||
case COFF_Archive_Thin: return coff_thin_archive_parse_from_data(raw_archive);
|
case COFF_Archive_Thin: return coff_thin_archive_parse_from_data(raw_archive);
|
||||||
}
|
}
|
||||||
COFF_ArchiveParse null_parse = {0};
|
COFF_ArchiveParse null_parse = {0};
|
||||||
return null_parse;
|
return null_parse;
|
||||||
|
|||||||
+1
-1
@@ -1555,7 +1555,7 @@ internal PE_ResourceNode *
|
|||||||
pe_resource_dir_search_node(PE_ResourceDir *dir, COFF_ResourceID id)
|
pe_resource_dir_search_node(PE_ResourceDir *dir, COFF_ResourceID id)
|
||||||
{
|
{
|
||||||
for (PE_ResourceNode *i = dir->id_list.first; i != NULL; i = i->next) {
|
for (PE_ResourceNode *i = dir->id_list.first; i != NULL; i = i->next) {
|
||||||
if (coff_resource_id_compar(&i->data.id, &id)) {
|
if (coff_resource_id_compar(&i->data.id, &id) == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11664,8 +11664,8 @@ rd_frame(void)
|
|||||||
|
|
||||||
//- TODO(rjf): @cfg debugging: stringify the current cfg tree
|
//- TODO(rjf): @cfg debugging: stringify the current cfg tree
|
||||||
{
|
{
|
||||||
String8 string = rd_string_from_cfg_tree(scratch.arena, rd_state->root_cfg);
|
// String8 string = rd_string_from_cfg_tree(scratch.arena, rd_state->root_cfg);
|
||||||
int x = 0;
|
// int x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
@@ -12391,10 +12391,13 @@ rd_frame(void)
|
|||||||
originating_window = rd_state->first_window;
|
originating_window = rd_state->first_window;
|
||||||
}
|
}
|
||||||
OS_Handle preferred_monitor = {0};
|
OS_Handle preferred_monitor = {0};
|
||||||
RD_Window *new_ws = rd_window_open(v2f32(1280, 720), preferred_monitor, RD_CfgSrc_User);
|
DeferLoop(depth += 1, depth -= 1)
|
||||||
if(originating_window)
|
|
||||||
{
|
{
|
||||||
MemoryCopy(new_ws->setting_vals, originating_window->setting_vals, sizeof(RD_SettingVal)*RD_SettingCode_COUNT);
|
RD_Window *new_ws = rd_window_open(v2f32(1280, 720), preferred_monitor, RD_CfgSrc_User);
|
||||||
|
if(originating_window)
|
||||||
|
{
|
||||||
|
MemoryCopy(new_ws->setting_vals, originating_window->setting_vals, sizeof(RD_SettingVal)*RD_SettingCode_COUNT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case RD_CmdKind_CloseWindow:
|
case RD_CmdKind_CloseWindow:
|
||||||
@@ -12484,6 +12487,7 @@ rd_frame(void)
|
|||||||
case RD_CmdKind_OpenProject:
|
case RD_CmdKind_OpenProject:
|
||||||
{
|
{
|
||||||
//- TODO(rjf): @cfg load & apply user/project data to the cfg data structure
|
//- TODO(rjf): @cfg load & apply user/project data to the cfg data structure
|
||||||
|
#if 0
|
||||||
{
|
{
|
||||||
String8 file_root_key = (kind == RD_CmdKind_OpenUser ? str8_lit("user") : str8_lit("project"));
|
String8 file_root_key = (kind == RD_CmdKind_OpenUser ? str8_lit("user") : str8_lit("project"));
|
||||||
RD_Cfg *file_root = rd_cfg_child_from_string(rd_state->root_cfg, file_root_key);
|
RD_Cfg *file_root = rd_cfg_child_from_string(rd_state->root_cfg, file_root_key);
|
||||||
@@ -12508,6 +12512,7 @@ rd_frame(void)
|
|||||||
rd_cfg_insert_child(file_root, file_root->last, n->v);
|
rd_cfg_insert_child(file_root, file_root->last, n->v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO(rjf): dear lord this is so overcomplicated, this needs to be collapsed down & simplified ASAP
|
// TODO(rjf): dear lord this is so overcomplicated, this needs to be collapsed down & simplified ASAP
|
||||||
|
|
||||||
|
|||||||
@@ -6395,10 +6395,10 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
|||||||
{
|
{
|
||||||
eval.space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->process), RD_EvalSpaceKind_CtrlEntity);
|
eval.space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->process), RD_EvalSpaceKind_CtrlEntity);
|
||||||
space_range = rd_whole_range_from_eval_space(eval.space);
|
space_range = rd_whole_range_from_eval_space(eval.space);
|
||||||
if(dim_1u64(space_range) == 0)
|
}
|
||||||
{
|
if(eval.space.kind == RD_EvalSpaceKind_CtrlEntity && dim_1u64(space_range) == KB(16))
|
||||||
space_range = r1u64(0, 0x7FFFFFFFFFFFull);
|
{
|
||||||
}
|
space_range = r1u64(0, 0x7FFFFFFFFFFFull);
|
||||||
}
|
}
|
||||||
U64 cursor = rd_value_from_params_key(params, str8_lit("cursor_vaddr")).u64;
|
U64 cursor = rd_value_from_params_key(params, str8_lit("cursor_vaddr")).u64;
|
||||||
U64 mark = rd_value_from_params_key(params, str8_lit("mark_vaddr")).u64;
|
U64 mark = rd_value_from_params_key(params, str8_lit("mark_vaddr")).u64;
|
||||||
|
|||||||
@@ -320,6 +320,8 @@ rd_format_preamble(Arena *arena, String8List *out, String8 indent, String8 input
|
|||||||
input_type_string = "COFF/PE";
|
input_type_string = "COFF/PE";
|
||||||
} else if (rd_is_rdi(raw_data)) {
|
} else if (rd_is_rdi(raw_data)) {
|
||||||
input_type_string = "RDI";
|
input_type_string = "RDI";
|
||||||
|
} else if (pe_is_res(raw_data)) {
|
||||||
|
input_type_string = "RES";
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime universal_dt = os_now_universal_time();
|
DateTime universal_dt = os_now_universal_time();
|
||||||
@@ -6385,6 +6387,56 @@ coff_print_archive(Arena *arena, String8List *out, String8 indent, String8 raw_a
|
|||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal String8
|
||||||
|
coff_string_from_resource_id(Arena *arena, COFF_ResourceID id)
|
||||||
|
{
|
||||||
|
String8 result = str8_zero();
|
||||||
|
switch (id.type) {
|
||||||
|
case COFF_ResourceIDType_Null: result = str8_lit("\?\?\?"); break;
|
||||||
|
case COFF_ResourceIDType_Number: result = push_str8f(arena, "%u", id.u.number); break;
|
||||||
|
case COFF_ResourceIDType_String: result = id.u.string; break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
coff_print_parsed_res(Arena *arena, String8List *out, String8 indent, COFF_ParsedResource *res)
|
||||||
|
{
|
||||||
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
|
||||||
|
String8 type;
|
||||||
|
if (res->type.type == COFF_ResourceIDType_Number) {
|
||||||
|
type = pe_resource_kind_to_string(res->type.u.number);
|
||||||
|
} else {
|
||||||
|
type = coff_string_from_resource_id(scratch.arena, res->type);
|
||||||
|
}
|
||||||
|
|
||||||
|
String8 name = coff_string_from_resource_id(scratch.arena, res->name);
|
||||||
|
String8 flags = coff_string_from_resource_memory_flags(scratch.arena, res->memory_flags);
|
||||||
|
|
||||||
|
rd_printf("Type: %S", type);
|
||||||
|
rd_printf("Name: %S", name);
|
||||||
|
rd_printf("Language ID: %u", res->language_id);
|
||||||
|
rd_printf("Data Version: %u", res->data_version);
|
||||||
|
rd_printf("Version: %u", res->version);
|
||||||
|
rd_printf("Memory Flags: %S", flags);
|
||||||
|
rd_printf("Data size: %u (bytes)", res->data.size);
|
||||||
|
|
||||||
|
scratch_end(scratch);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
coff_print_res(Arena *arena, String8List *out, String8 indent, String8 raw_res)
|
||||||
|
{
|
||||||
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
COFF_ParsedResourceList res_list = coff_resource_list_from_data(scratch.arena, raw_res);
|
||||||
|
for (COFF_ParsedResourceNode *n = res_list.first; n != 0; n = n->next) {
|
||||||
|
coff_print_parsed_res(arena, out, indent, &n->data);
|
||||||
|
rd_newline();
|
||||||
|
}
|
||||||
|
scratch_end(scratch);
|
||||||
|
}
|
||||||
|
|
||||||
// MSVC CRT
|
// MSVC CRT
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ entry_point(CmdLine *cmdline)
|
|||||||
}
|
}
|
||||||
pe_print(arena, out, indent, raw_data, opts, rdi);
|
pe_print(arena, out, indent, raw_data, opts, rdi);
|
||||||
} else if (pe_is_res(raw_data)) {
|
} else if (pe_is_res(raw_data)) {
|
||||||
//tool_out_coff_res(stdout, file_data);
|
coff_print_res(arena, out, indent, raw_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:;
|
exit:;
|
||||||
|
|||||||
@@ -24,8 +24,10 @@
|
|||||||
#include "async/async.h"
|
#include "async/async.h"
|
||||||
#include "rdi_make/rdi_make_local.h"
|
#include "rdi_make/rdi_make_local.h"
|
||||||
#include "coff/coff.h"
|
#include "coff/coff.h"
|
||||||
|
#include "coff/coff_parse.h"
|
||||||
#include "codeview/codeview.h"
|
#include "codeview/codeview.h"
|
||||||
#include "codeview/codeview_stringize.h"
|
#include "codeview/codeview_parse.h"
|
||||||
|
#include "codeview/codeview_enum.h"
|
||||||
#include "msf/msf.h"
|
#include "msf/msf.h"
|
||||||
#include "msf/msf_parse.h"
|
#include "msf/msf_parse.h"
|
||||||
#include "pdb/pdb.h"
|
#include "pdb/pdb.h"
|
||||||
@@ -39,8 +41,10 @@
|
|||||||
#include "async/async.c"
|
#include "async/async.c"
|
||||||
#include "rdi_make/rdi_make_local.c"
|
#include "rdi_make/rdi_make_local.c"
|
||||||
#include "coff/coff.c"
|
#include "coff/coff.c"
|
||||||
|
#include "coff/coff_parse.c"
|
||||||
#include "codeview/codeview.c"
|
#include "codeview/codeview.c"
|
||||||
#include "codeview/codeview_stringize.c"
|
#include "codeview/codeview_parse.c"
|
||||||
|
#include "codeview/codeview_enum.c"
|
||||||
#include "msf/msf.c"
|
#include "msf/msf.c"
|
||||||
#include "msf/msf_parse.c"
|
#include "msf/msf_parse.c"
|
||||||
#include "pdb/pdb.c"
|
#include "pdb/pdb.c"
|
||||||
|
|||||||
Reference in New Issue
Block a user