mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-31 03:10:03 +00:00
moved Guid struct and related helpers to base
This commit is contained in:
@@ -208,7 +208,7 @@ typedef struct CV_UDTInfo
|
||||
typedef struct CV_TypeServerInfo
|
||||
{
|
||||
String8 name;
|
||||
OS_Guid sig;
|
||||
Guid sig;
|
||||
U32 age;
|
||||
} CV_TypeServerInfo;
|
||||
|
||||
|
||||
+4
-4
@@ -1402,7 +1402,7 @@ lnk_build_debug_pdb(LNK_SectionTable *st,
|
||||
LNK_Section *sect,
|
||||
LNK_Chunk *dir_array_chunk,
|
||||
COFF_TimeStamp time_stamp,
|
||||
OS_Guid guid,
|
||||
Guid guid,
|
||||
U32 age,
|
||||
String8 pdb_path)
|
||||
{
|
||||
@@ -1429,7 +1429,7 @@ lnk_build_debug_rdi(LNK_SectionTable *st,
|
||||
LNK_Section *debug_sect,
|
||||
LNK_Chunk *debug_dir_array_chunk,
|
||||
COFF_TimeStamp time_stamp,
|
||||
OS_Guid guid,
|
||||
Guid guid,
|
||||
String8 rdi_path)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
@@ -4077,8 +4077,8 @@ l.count += 1; \
|
||||
U128 hash = lnk_blake3_hash_parallel(tp, 128, image_data);
|
||||
MemoryCopy(&config->guid, hash.u64, sizeof(hash.u64));
|
||||
|
||||
U64 guid_foff = lnk_file_off_from_symbol(sect_id_map, guid_symbol);
|
||||
OS_Guid *guid_ptr = (OS_Guid *)(image_data.str + guid_foff);
|
||||
U64 guid_foff = lnk_file_off_from_symbol(sect_id_map, guid_symbol);
|
||||
Guid *guid_ptr = (Guid *)(image_data.str + guid_foff);
|
||||
MemoryCopy(guid_ptr, hash.u64, sizeof(hash.u64));
|
||||
|
||||
ProfEnd();
|
||||
|
||||
+2
-2
@@ -269,8 +269,8 @@ internal String8 lnk_make_linker_coff_obj(TP_Context *tp, Arena *arena, COFF_Tim
|
||||
////////////////////////////////
|
||||
// Win32 Image Helpers
|
||||
|
||||
internal void lnk_build_debug_pdb(LNK_SectionTable *st, LNK_SymbolTable *symtab, LNK_Section *debug_sect, LNK_Chunk *debug_dir_array_chunk, COFF_TimeStamp time_stamp, OS_Guid guid, U32 age, String8 pdb_path);
|
||||
internal void lnk_build_debug_rdi(LNK_SectionTable *st, LNK_SymbolTable *symtab, LNK_Section *debug_sect, LNK_Chunk *debug_dir_array_chunk, COFF_TimeStamp time_stamp, OS_Guid guid, String8 rdi_path);
|
||||
internal void lnk_build_debug_pdb(LNK_SectionTable *st, LNK_SymbolTable *symtab, LNK_Section *debug_sect, LNK_Chunk *debug_dir_array_chunk, COFF_TimeStamp time_stamp, Guid guid, U32 age, String8 pdb_path);
|
||||
internal void lnk_build_debug_rdi(LNK_SectionTable *st, LNK_SymbolTable *symtab, LNK_Section *debug_sect, LNK_Chunk *debug_dir_array_chunk, COFF_TimeStamp time_stamp, Guid guid, String8 rdi_path);
|
||||
internal void lnk_build_guard_tables(TP_Context *tp, LNK_SectionTable *st, LNK_SymbolTable *symtab, LNK_ExportTable *exptab, LNK_ObjList obj_list, COFF_MachineType machine, String8 entry_point_name, LNK_GuardFlags guard_flags, B32 emit_suppress_flag);
|
||||
internal void lnk_build_base_relocs(TP_Context *tp, TP_Arena *tp_arena, LNK_SectionTable *st, LNK_SymbolTable *symtab, COFF_MachineType machine, U64 page_size, LNK_ObjList obj_list);
|
||||
internal LNK_Chunk * lnk_build_dos_header(LNK_SymbolTable *symtab, LNK_Section *header_sect, LNK_Chunk *parent_chunk);
|
||||
|
||||
@@ -1515,8 +1515,8 @@ lnk_config_from_cmd_line(Arena *arena, String8List raw_cmd_line)
|
||||
} else if (str8_match(cmd->value_strings.first->string, str8_lit("random"), StringMatchFlag_CaseInsensitive)) {
|
||||
config->guid = os_make_guid();
|
||||
} else {
|
||||
OS_Guid guid;
|
||||
if (os_try_guid_from_string(cmd->value_strings.first->string, &guid)) {
|
||||
Guid guid;
|
||||
if (try_guid_from_string(cmd->value_strings.first->string, &guid)) {
|
||||
config->guid = guid;
|
||||
} else {
|
||||
lnk_error_cmd_switch(LNK_Error_Cmdl, cmd_switch, "unable to parse \"%S\"", cmd->value_strings.first->string);
|
||||
|
||||
@@ -244,7 +244,7 @@ typedef struct LNK_Config
|
||||
U64 opt_iter_count;
|
||||
LNK_GuardFlags guard_flags;
|
||||
LNK_DebugInfoGuidType guid_type;
|
||||
OS_Guid guid;
|
||||
Guid guid;
|
||||
COFF_TimeStamp time_stamp;
|
||||
U32 age;
|
||||
U64 section_virt_off;
|
||||
|
||||
@@ -708,8 +708,8 @@ lnk_make_code_view_input(TP_Context *tp, TP_Arena *tp_arena, String8List lib_dir
|
||||
pdb_info_parse_from_data(msf_parse->streams[PDB_FixedStream_Info], &info_parse);
|
||||
if (!MemoryMatchStruct(&info_parse.guid, &ts_info_arr[ts_idx].sig)) {
|
||||
Temp scratch = scratch_begin(0,0);
|
||||
String8 expected_sig_str = os_string_from_guid(scratch.arena, ts_info_arr[ts_idx].sig);
|
||||
String8 on_disk_sig_str = os_string_from_guid(scratch.arena, info_parse.guid);
|
||||
String8 expected_sig_str = string_from_guid(scratch.arena, ts_info_arr[ts_idx].sig);
|
||||
String8 on_disk_sig_str = string_from_guid(scratch.arena, info_parse.guid);
|
||||
lnk_error(LNK_Warning_MismatchedTypeServerSignature, "%S: signature mismatch in type server read from disk, expected %S, got %S",
|
||||
ts_info_arr[ts_idx].name, expected_sig_str, on_disk_sig_str);
|
||||
scratch_end(scratch);
|
||||
@@ -3121,7 +3121,7 @@ lnk_build_pdb_public_symbols(TP_Context *tp,
|
||||
internal String8List
|
||||
lnk_build_pdb(TP_Context *tp,
|
||||
TP_Arena *tp_arena,
|
||||
OS_Guid guid,
|
||||
Guid guid,
|
||||
COFF_MachineType machine,
|
||||
COFF_TimeStamp time_stamp,
|
||||
U32 age,
|
||||
|
||||
@@ -581,7 +581,7 @@ internal void lnk_build_pdb_public_symbols(TP_Context *tp,
|
||||
|
||||
internal String8List lnk_build_pdb(TP_Context *tp,
|
||||
TP_Arena *tp_arena,
|
||||
OS_Guid guid,
|
||||
Guid guid,
|
||||
COFF_MachineType machine,
|
||||
COFF_TimeStamp time_stamp,
|
||||
U32 age,
|
||||
|
||||
@@ -139,50 +139,3 @@ operating_system_from_string(String8 string)
|
||||
return OperatingSystem_Null;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_try_guid_from_string(String8 string, OS_Guid *guid_out)
|
||||
{
|
||||
Temp scratch = scratch_begin(0,0);
|
||||
B32 is_parsed = 0;
|
||||
String8List list = str8_split_by_string_chars(scratch.arena, string, str8_lit("-"), StringSplitFlag_KeepEmpties);
|
||||
if (list.node_count == 5) {
|
||||
String8 data1_str = list.first->string;
|
||||
String8 data2_str = list.first->next->string;
|
||||
String8 data3_str = list.first->next->next->string;
|
||||
String8 data4_hi_str = list.first->next->next->next->string;
|
||||
String8 data4_lo_str = list.first->next->next->next->next->string;
|
||||
if (str8_is_integer(data1_str, 16) &&
|
||||
str8_is_integer(data2_str, 16) &&
|
||||
str8_is_integer(data3_str, 16) &&
|
||||
str8_is_integer(data4_hi_str, 16) &&
|
||||
str8_is_integer(data4_lo_str, 16)) {
|
||||
U64 data1 = u64_from_str8(data1_str, 16);
|
||||
U64 data2 = u64_from_str8(data2_str, 16);
|
||||
U64 data3 = u64_from_str8(data3_str, 16);
|
||||
U64 data4_hi = u64_from_str8(data4_hi_str, 16);
|
||||
U64 data4_lo = u64_from_str8(data4_lo_str, 16);
|
||||
if (data1 <= max_U32 &&
|
||||
data2 <= max_U16 &&
|
||||
data3 <= max_U16 &&
|
||||
data4_hi <= max_U16 &&
|
||||
data4_lo <= 0xffffffffffff) {
|
||||
guid_out->data1 = (U32)data1;
|
||||
guid_out->data2 = (U16)data2;
|
||||
guid_out->data3 = (U16)data3;
|
||||
U64 data4 = (data4_hi << 48) | data4_lo;
|
||||
MemoryCopy(&guid_out->data4[0], &data4, sizeof(data4));
|
||||
is_parsed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return is_parsed;
|
||||
}
|
||||
|
||||
internal OS_Guid
|
||||
os_guid_from_string(String8 string)
|
||||
{
|
||||
OS_Guid guid = {0};
|
||||
os_try_guid_from_string(string, &guid);
|
||||
return guid;
|
||||
}
|
||||
|
||||
@@ -35,5 +35,3 @@ internal B32 os_set_large_pages(B32 toggle);
|
||||
|
||||
internal U32 os_get_process_start_time_unix(void);
|
||||
|
||||
internal B32 os_try_guid_from_string(String8 string, OS_Guid *guid_out);
|
||||
internal OS_Guid os_guid_from_string(String8 string);
|
||||
|
||||
@@ -1648,7 +1648,7 @@ pdb_load_types_from_leaf_list(PDB_TypeServer **type_server_arr, CV_LeafList leaf
|
||||
////////////////////////////////
|
||||
|
||||
internal PDB_InfoContext *
|
||||
pdb_info_alloc(U32 age, COFF_TimeStamp time_stamp, OS_Guid guid)
|
||||
pdb_info_alloc(U32 age, COFF_TimeStamp time_stamp, Guid guid)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Arena *arena = arena_alloc();
|
||||
@@ -3528,7 +3528,7 @@ pdb_alloc_msf(U64 page_size)
|
||||
}
|
||||
|
||||
internal PDB_Context *
|
||||
pdb_alloc(U64 page_size, COFF_MachineType machine, COFF_TimeStamp time_stamp, U32 age, OS_Guid guid)
|
||||
pdb_alloc(U64 page_size, COFF_MachineType machine, COFF_TimeStamp time_stamp, U32 age, Guid guid)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Arena *arena = arena_alloc();
|
||||
@@ -3606,7 +3606,7 @@ pdb_set_machine(PDB_Context *pdb, COFF_MachineType machine)
|
||||
}
|
||||
|
||||
internal void
|
||||
pdb_set_guid(PDB_Context *pdb, OS_Guid guid)
|
||||
pdb_set_guid(PDB_Context *pdb, Guid guid)
|
||||
{
|
||||
pdb->info->guid = guid;
|
||||
}
|
||||
@@ -3642,7 +3642,7 @@ pdb_get_age(PDB_Context *pdb)
|
||||
return pdb->info->age;
|
||||
}
|
||||
|
||||
internal OS_Guid
|
||||
internal Guid
|
||||
pdb_get_guid(PDB_Context *pdb)
|
||||
{
|
||||
return pdb->info->guid;
|
||||
|
||||
@@ -154,7 +154,7 @@ typedef struct PDB_InfoParse
|
||||
PDB_TpiVersion version;
|
||||
COFF_TimeStamp time_stamp;
|
||||
U32 age;
|
||||
OS_Guid guid;
|
||||
Guid guid;
|
||||
String8 extra_info;
|
||||
} PDB_InfoParse;
|
||||
|
||||
@@ -163,7 +163,7 @@ typedef struct PDB_InfoContext
|
||||
Arena *arena;
|
||||
COFF_TimeStamp time_stamp;
|
||||
U32 age;
|
||||
OS_Guid guid;
|
||||
Guid guid;
|
||||
PDB_FeatureFlags flags;
|
||||
PDB_HashTable named_stream_ht;
|
||||
PDB_HashTable src_header_block_ht;
|
||||
@@ -347,23 +347,23 @@ typedef struct
|
||||
////////////////////////////////
|
||||
// PDB
|
||||
|
||||
internal PDB_Context * pdb_alloc(U64 page_size, COFF_MachineType machine, COFF_TimeStamp time_stamp, U32 age, OS_Guid guid);
|
||||
internal PDB_Context * pdb_alloc(U64 page_size, COFF_MachineType machine, COFF_TimeStamp time_stamp, U32 age, Guid guid);
|
||||
internal PDB_Context * pdb_open(String8 data);
|
||||
internal void pdb_release(PDB_Context **pdb_ptr);
|
||||
internal void pdb_build(TP_Context *tp, TP_Arena *pool_temp, PDB_Context *pdb, CV_StringHashTable string_ht);
|
||||
internal void pdb_set_machine(PDB_Context *pdb, COFF_MachineType machine);
|
||||
internal void pdb_set_guid(PDB_Context *pdb, OS_Guid guid);
|
||||
internal void pdb_set_guid(PDB_Context *pdb, Guid guid);
|
||||
internal void pdb_set_time_stamp(PDB_Context *pdb, COFF_TimeStamp time_stamp);
|
||||
internal void pdb_set_age(PDB_Context *pdb, U32 age);
|
||||
internal COFF_MachineType pdb_get_machine(PDB_Context *pdb);
|
||||
internal COFF_TimeStamp pdb_get_time_stamp(PDB_Context *pdb);
|
||||
internal U32 pdb_get_age(PDB_Context *pdb);
|
||||
internal OS_Guid pdb_get_guid(PDB_Context *pdb);
|
||||
internal Guid pdb_get_guid(PDB_Context *pdb);
|
||||
|
||||
////////////////////////////////
|
||||
// Info
|
||||
|
||||
internal PDB_InfoContext * pdb_info_alloc(U32 age, COFF_TimeStamp time_stamp, OS_Guid guid);
|
||||
internal PDB_InfoContext * pdb_info_alloc(U32 age, COFF_TimeStamp time_stamp, Guid guid);
|
||||
internal void pdb_info_parse_from_data(String8 data, PDB_InfoParse *parse_out);
|
||||
internal PDB_InfoContext * pdb_info_open(MSF_Context *msf, MSF_StreamNumber sn);
|
||||
internal void pdb_info_build(PDB_InfoContext *info, MSF_Context *msf, MSF_StreamNumber sn);
|
||||
|
||||
Reference in New Issue
Block a user