linux -> prefix user raddbg data with ., so we get ~/.raddbg normally - on windows keep normal style

This commit is contained in:
Ryan Fleury
2026-05-18 20:18:53 -07:00
parent a75cb2c32d
commit fe4de192e4
8 changed files with 47 additions and 29 deletions
+16
View File
@@ -1443,6 +1443,22 @@ str8_from_version(Arena *arena, U64 version)
//////////////////////////////// ////////////////////////////////
//~ rjf: String Path Helpers //~ rjf: String Path Helpers
internal String8
program_data_folder_prefix_from_os(OperatingSystem os)
{
String8 result = {0};
switch(os)
{
default:{}break;
case OperatingSystem_Linux:
case OperatingSystem_Mac:
{
result = s(".");
}break;
}
return result;
}
internal String8 internal String8
str8_chop_last_slash(String8 string) str8_chop_last_slash(String8 string)
{ {
+2
View File
@@ -319,6 +319,8 @@ g_path_style_map[] =
{ str8_lit_comp("system"), PathStyle_SystemAbsolute }, { str8_lit_comp("system"), PathStyle_SystemAbsolute },
}; };
internal String8 program_data_folder_prefix_from_os(OperatingSystem os);
internal String8 str8_chop_last_slash(String8 string); internal String8 str8_chop_last_slash(String8 string);
internal String8 str8_skip_last_slash(String8 string); internal String8 str8_skip_last_slash(String8 string);
internal String8 str8_chop_last_dot(String8 string); internal String8 str8_chop_last_dot(String8 string);
+1 -1
View File
@@ -52,7 +52,7 @@ D_CmdTable: // | | | |
{Attach 1 1 0 0 "query:unattached_processes" PID null Nil Null 0 0 0 0 0 1 1 Null "attach" "Attach" "Attaches to a process that is already running on the local machine." "" "" } {Attach 1 1 0 0 "query:unattached_processes" PID null Nil Null 0 0 0 0 0 1 1 Null "attach" "Attach" "Attaches to a process that is already running on the local machine." "" "" }
//- rjf: crash dump opening //- rjf: crash dump opening
{OpenCrashDump 1 1 0 0 `folder:\\"$input\\"` FilePath null Nil Null 0 0 0 0 0 1 1 Null "open_crash_dump" "Open Crash Dump" "Opens a crash dump file and recreates debuggee state at the time of the crash." "" "" } {OpenCrashDump 1 1 0 0 `folder:\\"$input\\"` FilePath null Nil Null 0 0 0 0 0 1 1 FileOutline "open_crash_dump" "Open Crash Dump" "Opens a crash dump file and recreates debuggee state at the time of the crash." "" "" }
} }
@enum D_CmdKind: @enum D_CmdKind:
+1 -1
View File
@@ -58,7 +58,7 @@ d_init(void)
{ {
Temp scratch = scratch_begin(0, 0); Temp scratch = scratch_begin(0, 0);
String8 user_program_data_path = get_process_info()->user_program_data_path; String8 user_program_data_path = get_process_info()->user_program_data_path;
String8 user_data_folder = push_str8f(scratch.arena, "%S/raddbg/logs", user_program_data_path); String8 user_data_folder = push_str8f(scratch.arena, "%S/%Sraddbg/logs", user_program_data_path, program_data_folder_prefix_from_os(OperatingSystem_CURRENT));
make_directory(user_data_folder); make_directory(user_data_folder);
d_ctrl_state->ctrl_thread_log_path = push_str8f(d_ctrl_state->arena, "%S/ctrl_thread.raddbg_log", user_data_folder); d_ctrl_state->ctrl_thread_log_path = push_str8f(d_ctrl_state->arena, "%S/ctrl_thread.raddbg_log", user_data_folder);
write_data_to_file_path(d_ctrl_state->ctrl_thread_log_path, str8_zero()); write_data_to_file_path(d_ctrl_state->ctrl_thread_log_path, str8_zero());
+21 -21
View File
@@ -5213,6 +5213,27 @@ d_ctrl_thread__open_crash_dump(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
} }
} }
// rjf: allocate parse artifact arena
arena = arena_alloc();
// rjf: gather memory ranges
memory_ranges_count = memories_count + memories64_count;
memory_ranges = push_array(arena, D_DumpMemoryRange, memory_ranges_count);
for EachIndex(idx, memories_count)
{
memory_ranges[idx].base_vaddr = memories[idx].start_of_memory_range;
memory_ranges[idx].foff_range = r1u64(memories[idx].memory_location.foff, memories[idx].memory_location.foff+memories[idx].memory_location.data_size);
}
{
U64 foff = memories64_base_foff;
for EachIndex(idx, memories64_count)
{
memory_ranges[memories_count + idx].base_vaddr = memories64[memories_count + idx].start_of_memory_range;
memory_ranges[memories_count + idx].foff_range = r1u64(foff, foff+memories64[idx].size);
foff += memories64[idx].size;
}
}
// rjf: system info -> arch // rjf: system info -> arch
Arch arch = Arch_Null; Arch arch = Arch_Null;
if(system_info != 0) switch(system_info->processor_architecture) if(system_info != 0) switch(system_info->processor_architecture)
@@ -5311,27 +5332,6 @@ d_ctrl_thread__open_crash_dump(DMN_CtrlCtx *ctrl_ctx, D_Msg *msg)
evt->string = initial_debug_info_path; evt->string = initial_debug_info_path;
} }
} }
// rjf: allocate parse artifact arena
arena = arena_alloc();
// rjf: gather memory ranges
memory_ranges_count = memories_count + memories64_count;
memory_ranges = push_array(arena, D_DumpMemoryRange, memory_ranges_count);
for EachIndex(idx, memories_count)
{
memory_ranges[idx].base_vaddr = memories[idx].start_of_memory_range;
memory_ranges[idx].foff_range = r1u64(memories[idx].memory_location.foff, memories[idx].memory_location.foff+memories[idx].memory_location.data_size);
}
{
U64 foff = memories64_base_foff;
for EachIndex(idx, memories64_count)
{
memory_ranges[memories_count + idx].base_vaddr = memories64[memories_count + idx].start_of_memory_range;
memory_ranges[memories_count + idx].foff_range = r1u64(foff, foff+memories64[idx].size);
foff += memories64[idx].size;
}
}
} }
} }
} }
+1 -1
View File
@@ -208,7 +208,7 @@ RD_VocabInfo rd_vocab_info_table[360] =
{str8_lit_comp("set_entity_color"), str8_lit_comp(""), str8_lit_comp("Set Entity Color"), str8_lit_comp(""), RD_IconKind_Null}, {str8_lit_comp("set_entity_color"), str8_lit_comp(""), str8_lit_comp("Set Entity Color"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("set_entity_name"), str8_lit_comp(""), str8_lit_comp("Set Entity Name"), str8_lit_comp(""), RD_IconKind_Null}, {str8_lit_comp("set_entity_name"), str8_lit_comp(""), str8_lit_comp("Set Entity Name"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("attach"), str8_lit_comp(""), str8_lit_comp("Attach"), str8_lit_comp(""), RD_IconKind_Null}, {str8_lit_comp("attach"), str8_lit_comp(""), str8_lit_comp("Attach"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("open_crash_dump"), str8_lit_comp(""), str8_lit_comp("Open Crash Dump"), str8_lit_comp(""), RD_IconKind_Null}, {str8_lit_comp("open_crash_dump"), str8_lit_comp(""), str8_lit_comp("Open Crash Dump"), str8_lit_comp(""), RD_IconKind_FileOutline},
{str8_lit_comp("exit"), str8_lit_comp(""), str8_lit_comp("Exit"), str8_lit_comp(""), RD_IconKind_X}, {str8_lit_comp("exit"), str8_lit_comp(""), str8_lit_comp("Exit"), str8_lit_comp(""), RD_IconKind_X},
{str8_lit_comp("open_palette"), str8_lit_comp(""), str8_lit_comp("Open Palette"), str8_lit_comp(""), RD_IconKind_List}, {str8_lit_comp("open_palette"), str8_lit_comp(""), str8_lit_comp("Open Palette"), str8_lit_comp(""), RD_IconKind_List},
{str8_lit_comp("run_command"), str8_lit_comp(""), str8_lit_comp("Run Command"), str8_lit_comp(""), RD_IconKind_Null}, {str8_lit_comp("run_command"), str8_lit_comp(""), str8_lit_comp("Run Command"), str8_lit_comp(""), RD_IconKind_Null},
+4 -4
View File
@@ -9460,7 +9460,7 @@ rd_theme_tree_from_name(Arena *arena, Access *access, String8 theme_name)
} }
if(theme_tree == &md_nil_node) if(theme_tree == &md_nil_node)
{ {
String8 path = str8f(scratch.arena, "%S/raddbg/themes/%S", get_process_info()->user_program_data_path, theme_name); String8 path = str8f(scratch.arena, "%S/%Sraddbg/themes/%S", program_data_folder_prefix_from_os(OperatingSystem_CURRENT), get_process_info()->user_program_data_path, theme_name);
U64 endt_us = now_time_us()+100; U64 endt_us = now_time_us()+100;
if(rd_state->frame_index <= 5) if(rd_state->frame_index <= 5)
{ {
@@ -10293,7 +10293,7 @@ rd_init(CmdLine *cmdln)
{ {
Temp scratch = scratch_begin(0, 0); Temp scratch = scratch_begin(0, 0);
String8 user_program_data_path = get_process_info()->user_program_data_path; String8 user_program_data_path = get_process_info()->user_program_data_path;
String8 user_data_folder = push_str8f(scratch.arena, "%S/raddbg/logs", user_program_data_path); String8 user_data_folder = push_str8f(scratch.arena, "%S/%Sraddbg/logs", user_program_data_path, program_data_folder_prefix_from_os(OperatingSystem_CURRENT));
rd_state->log_path = push_str8f(rd_state->arena, "%S/ui_thread.raddbg_log", user_data_folder); rd_state->log_path = push_str8f(rd_state->arena, "%S/ui_thread.raddbg_log", user_data_folder);
make_directory(user_data_folder); make_directory(user_data_folder);
write_data_to_file_path(rd_state->log_path, str8_zero()); write_data_to_file_path(rd_state->log_path, str8_zero());
@@ -12987,7 +12987,7 @@ rd_frame(void)
case RD_CmdKind_RecordUserAsLastOpened: case RD_CmdKind_RecordUserAsLastOpened:
{ {
String8 file_path = rd_regs()->file_path; String8 file_path = rd_regs()->file_path;
String8 last_user_path = str8f(scratch.arena, "%S/raddbg/last_user", get_process_info()->user_program_data_path); String8 last_user_path = str8f(scratch.arena, "%S/%Sraddbg/last_user", get_process_info()->user_program_data_path, program_data_folder_prefix_from_os(OperatingSystem_CURRENT));
write_data_to_file_path(last_user_path, file_path); write_data_to_file_path(last_user_path, file_path);
}break; }break;
@@ -15555,7 +15555,7 @@ rd_frame(void)
String8 name = rd_regs()->string; String8 name = rd_regs()->string;
if(name.size != 0) if(name.size != 0)
{ {
String8 themes_folder = str8f(scratch.arena, "%S/raddbg/themes", get_process_info()->user_program_data_path); String8 themes_folder = str8f(scratch.arena, "%S/%Sraddbg/themes", get_process_info()->user_program_data_path, program_data_folder_prefix_from_os(OperatingSystem_CURRENT));
if(make_directory(themes_folder)) if(make_directory(themes_folder))
{ {
String8 dst_path = push_str8f(scratch.arena, "%S/%S", themes_folder, name); String8 dst_path = push_str8f(scratch.arena, "%S/%S", themes_folder, name);
+1 -1
View File
@@ -122,7 +122,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(themes)
//- rjf: gather theme files //- rjf: gather theme files
{ {
String8 theme_folder = push_str8f(scratch.arena, "%S/raddbg/themes", get_process_info()->user_program_data_path); String8 theme_folder = push_str8f(scratch.arena, "%S/%Sraddbg/themes", get_process_info()->user_program_data_path, program_data_folder_prefix_from_os(OperatingSystem_CURRENT));
FileIter *it = file_iter_begin(scratch.arena, theme_folder, FileIterFlag_SkipFolders); FileIter *it = file_iter_begin(scratch.arena, theme_folder, FileIterFlag_SkipFolders);
for(FileInfo info = {0}; file_iter_next(scratch.arena, it, &info);) for(FileInfo info = {0}; file_iter_next(scratch.arena, it, &info);)
{ {