mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-23 20:24:59 -07:00
fix clang build; adjust raddbg --convert option to --bin
This commit is contained in:
+1
-1
@@ -1026,7 +1026,7 @@ ASYNC_WORK_DEF(di_parse_work)
|
||||
params.inherit_env = 1;
|
||||
params.consoleless = 1;
|
||||
str8_list_pushf(scratch.arena, ¶ms.cmd_line, "raddbg");
|
||||
str8_list_pushf(scratch.arena, ¶ms.cmd_line, "--convert");
|
||||
str8_list_pushf(scratch.arena, ¶ms.cmd_line, "--bin");
|
||||
str8_list_pushf(scratch.arena, ¶ms.cmd_line, "--quiet");
|
||||
if(should_compress)
|
||||
{
|
||||
|
||||
@@ -327,6 +327,8 @@ key_value_pairs_from_hash_table(Arena *arena, HashTable *ht)
|
||||
return pairs;
|
||||
}
|
||||
|
||||
#include "third_party/radsort/radsort.h"
|
||||
|
||||
internal void
|
||||
sort_key_value_pairs_as_u32(KeyValuePair *pairs, U64 count)
|
||||
{
|
||||
|
||||
@@ -512,6 +512,7 @@ rb_entry_point(CmdLine *cmdline)
|
||||
RDIM_SubsetFlags subset_flags = 0xffffffff;
|
||||
switch(output_kind)
|
||||
{
|
||||
default:{}break;
|
||||
case OutputKind_RDI:
|
||||
{
|
||||
String8List only_names = cmd_line_strings(cmdline, str8_lit("only"));
|
||||
@@ -687,6 +688,8 @@ rb_entry_point(CmdLine *cmdline)
|
||||
//- rjf: convert done => generate output
|
||||
if(convert_done) switch(output_kind)
|
||||
{
|
||||
default:{}break;
|
||||
|
||||
//- rjf: generate RDI blobs
|
||||
case OutputKind_RDI:
|
||||
{
|
||||
|
||||
@@ -316,7 +316,7 @@ typedef enum ExecMode
|
||||
{
|
||||
ExecMode_Normal,
|
||||
ExecMode_IPCSender,
|
||||
ExecMode_Converter,
|
||||
ExecMode_BinaryUtility,
|
||||
ExecMode_Help,
|
||||
}
|
||||
ExecMode;
|
||||
@@ -421,9 +421,9 @@ entry_point(CmdLine *cmd_line)
|
||||
{
|
||||
exec_mode = ExecMode_IPCSender;
|
||||
}
|
||||
else if(cmd_line_has_flag(cmd_line, str8_lit("convert")))
|
||||
else if(cmd_line_has_flag(cmd_line, str8_lit("bin")))
|
||||
{
|
||||
exec_mode = ExecMode_Converter;
|
||||
exec_mode = ExecMode_BinaryUtility;
|
||||
}
|
||||
else if(cmd_line_has_flag(cmd_line, str8_lit("?")) ||
|
||||
cmd_line_has_flag(cmd_line, str8_lit("help")))
|
||||
@@ -824,8 +824,8 @@ entry_point(CmdLine *cmd_line)
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
|
||||
//- rjf: built-in pdb/dwarf -> rdi converter mode
|
||||
case ExecMode_Converter:
|
||||
//- rjf: built-in binary utility mode
|
||||
case ExecMode_BinaryUtility:
|
||||
{
|
||||
rb_entry_point(cmd_line);
|
||||
}break;
|
||||
|
||||
@@ -558,111 +558,6 @@ rdi_strings_from_locations(Arena *arena, RDI_Parsed *rdi, RDI_Arch arch, Rng1U64
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Dumping
|
||||
|
||||
internal void
|
||||
rdi_dump_scope(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_Scope *scope, RDI_Arch arch)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
U64 scope_count = 0;
|
||||
U64 scope_voff_count = 0;
|
||||
U64 local_count = 0;
|
||||
U64 proc_count = 0;
|
||||
U64 inline_site_count = 0;
|
||||
RDI_Scope *scope_array = rdi_table_from_name(rdi, Scopes, &scope_count);
|
||||
U64 *scope_voff_array = rdi_table_from_name(rdi, ScopeVOffData, &scope_voff_count);
|
||||
RDI_Local *local_array = rdi_table_from_name(rdi, Locals, &local_count);
|
||||
RDI_Procedure *proc_array = rdi_table_from_name(rdi, Procedures, &proc_count);
|
||||
RDI_InlineSite *inline_site_array = rdi_table_from_name(rdi, InlineSites, &inline_site_count);
|
||||
|
||||
U32 voff_range_lo = ClampTop(scope->voff_range_first, scope_voff_count);
|
||||
U32 voff_range_hi = ClampTop(scope->voff_range_opl, scope_voff_count);
|
||||
U32 voff_range_count = (voff_range_hi - voff_range_lo);
|
||||
U64 *voff_ptr = scope_voff_array + voff_range_lo;
|
||||
String8 voff_str = {0};
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List list = {0};
|
||||
for(U64 i = 0; i+2 <= voff_range_count; i += 2)
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &list, "[%#llx, %#llx)", voff_ptr[i+0], voff_ptr[i+1]);
|
||||
}
|
||||
voff_str = str8_list_join(arena, &list, &(StringJoin){.sep=str8_lit(", ")});
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
U64 scope_idx = (U64)(scope - scope_array);
|
||||
dumpf("scope[%llu]", scope_idx);
|
||||
rd_indent();
|
||||
|
||||
String8 proc_name = str8_lit("???");
|
||||
if (scope->proc_idx < proc_count) {
|
||||
RDI_Procedure *proc = &proc_array[scope->proc_idx];
|
||||
proc_name = str8_from_rdi_string_idx(rdi, proc->name_string_idx);
|
||||
}
|
||||
|
||||
String8 inline_site_name = str8_lit("");
|
||||
if (scope->inline_site_idx != 0) {
|
||||
if (scope->inline_site_idx < inline_site_count) {
|
||||
RDI_InlineSite *inline_site = &inline_site_array[scope->inline_site_idx];
|
||||
inline_site_name = str8_from_rdi_string_idx(rdi, inline_site->name_string_idx);
|
||||
} else {
|
||||
inline_site_name = str8_lit("???");
|
||||
}
|
||||
inline_site_name = push_str8f(scratch.arena, " '%S'", inline_site_name);
|
||||
}
|
||||
|
||||
dumpf("proc_idx =%u '%S'", scope->proc_idx, proc_name);
|
||||
dumpf("first_child_scope_idx =%u", scope->first_child_scope_idx);
|
||||
dumpf("next_sibling_scope_idx=%u", scope->next_sibling_scope_idx);
|
||||
dumpf("inline_site_idx =%u%S", scope->inline_site_idx, inline_site_name);
|
||||
dumpf("voff_ranges =%S", voff_str);
|
||||
|
||||
// local_array
|
||||
{
|
||||
U32 local_lo = ClampTop(scope->local_first, local_count);
|
||||
U32 local_hi = ClampTop(local_lo + scope->local_count, local_count);
|
||||
if (local_lo < local_hi) {
|
||||
for (U32 local_idx = local_lo; local_idx < local_hi; ++local_idx) {
|
||||
RDI_Local *local_ptr = &local_array[local_idx];
|
||||
|
||||
dumpf("local[%u]", local_idx);
|
||||
rd_indent();
|
||||
dumpf("kind =%S", rdi_string_from_local_kind(scratch.arena, local_ptr->kind));
|
||||
dumpf("name ='%S'", str8_from_rdi_string_idx(rdi, local_ptr->name_string_idx));
|
||||
dumpf("type_idx=%u", local_ptr->type_idx);
|
||||
|
||||
if (local_ptr->location_first < local_ptr->location_opl) {
|
||||
dumpf("locations:");
|
||||
rd_indent();
|
||||
rdi_dump_locations(arena, out, indent, rdi, arch, local_ptr->location_first, local_ptr->location_opl);
|
||||
rd_unindent();
|
||||
}
|
||||
rd_unindent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (U32 child_scope_idx = scope->first_child_scope_idx; child_scope_idx != 0; ) {
|
||||
if (child_scope_idx >= scope_count) {
|
||||
rd_errorf("child scope index (%u) is out of bounds", child_scope_idx);
|
||||
break;
|
||||
}
|
||||
|
||||
rd_indent();
|
||||
RDI_Scope *child_scope = scope_array + child_scope_idx;
|
||||
rdi_dump_scope(arena, out, indent, rdi, child_scope, arch);
|
||||
rd_unindent();
|
||||
|
||||
// advance to next child
|
||||
child_scope_idx = child_scope->next_sibling_scope_idx;
|
||||
}
|
||||
|
||||
rd_unindent();
|
||||
dumpf("[/%llu]", scope_idx);
|
||||
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal String8List
|
||||
rdi_dump_list_from_parsed(Arena *arena, RDI_Parsed *rdi, RDI_DumpSubsetFlags flags)
|
||||
{
|
||||
|
||||
@@ -97,7 +97,6 @@ internal String8List rdi_strings_from_locations(Arena *arena, RDI_Parsed *rdi, R
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Dumping
|
||||
|
||||
internal void rdi_dump_scope (Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_Scope *scope, RDI_Arch arch);
|
||||
internal String8List rdi_dump_list_from_parsed(Arena *arena, RDI_Parsed *rdi, RDI_DumpSubsetFlags flags);
|
||||
|
||||
#endif // RDI_FORMAT_LOCAL_H
|
||||
|
||||
@@ -53,7 +53,7 @@ entry_point(CmdLine *cmdline)
|
||||
String8 dll_name = str8_skip_last_slash(dll_path_no_ext);
|
||||
String8 pdb_path = push_str8f(arena, "%S.pdb", dll_path_no_ext);
|
||||
String8 rdi_path = push_str8f(arena, "dump/%S.rdi", dll_name);
|
||||
OS_Handle handle = os_cmd_line_launchf("raddbg --convert --pdb:%S --out:%S", pdb_path, rdi_path);
|
||||
OS_Handle handle = os_cmd_line_launchf("raddbg --bin %S --out:%S", pdb_path, rdi_path);
|
||||
os_handle_list_push(arena, &processes, handle);
|
||||
if(processes_first_path_n == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user