mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
add switch to override default logs folder
This commit is contained in:
committed by
Ryan Fleury
parent
b4dd1f6fd3
commit
b23323c03d
@@ -9,6 +9,8 @@ C_LINKAGE thread_static Log *log_active;
|
||||
C_LINKAGE thread_static Log *log_active = 0;
|
||||
#endif
|
||||
|
||||
String8 g_logs_folder;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Log Creation/Selection
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ struct Log
|
||||
LogScope *top_scope;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
// Globals
|
||||
|
||||
extern String8 g_logs_folder;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Log Creation/Selection
|
||||
|
||||
|
||||
@@ -53,17 +53,12 @@ d_init(void)
|
||||
d_ctrl_state->c2u_ring_size = KB(64);
|
||||
d_ctrl_state->c2u_ring_max_string_size = d_ctrl_state->c2u_ring_size/2;
|
||||
d_ctrl_state->c2u_ring_base = push_array_no_zero(arena, U8, d_ctrl_state->c2u_ring_size);
|
||||
d_ctrl_state->c2u_ring_mutex = mutex_alloc();
|
||||
d_ctrl_state->c2u_ring_cv = cond_var_alloc();
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 user_program_data_path = get_process_info()->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);
|
||||
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());
|
||||
scratch_end(scratch);
|
||||
}
|
||||
d_ctrl_state->c2u_ring_mutex = mutex_alloc();
|
||||
d_ctrl_state->c2u_ring_cv = cond_var_alloc();
|
||||
{
|
||||
d_ctrl_state->ctrl_thread_log_path = push_str8f(d_ctrl_state->arena, "%S/ctrl_thread.raddbg_log", g_logs_folder);
|
||||
write_data_to_file_path(d_ctrl_state->ctrl_thread_log_path, str8_zero());
|
||||
}
|
||||
d_ctrl_state->ctrl_thread_entity_ctx_rw_mutex = rw_mutex_alloc();
|
||||
d_ctrl_state->ctrl_thread_entity_store = d_entity_ctx_rw_store_alloc();
|
||||
d_ctrl_state->ctrl_thread_eval_cache = e_cache_alloc();
|
||||
|
||||
@@ -10597,16 +10597,13 @@ rd_init(CmdLine *cmdln)
|
||||
rd_state->frame_arenas[idx] = arena_alloc();
|
||||
}
|
||||
rd_state->log = log_alloc();
|
||||
log_select(rd_state->log);
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 user_program_data_path = get_process_info()->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);
|
||||
make_directory(user_data_folder);
|
||||
write_data_to_file_path(rd_state->log_path, str8_zero());
|
||||
scratch_end(scratch);
|
||||
}
|
||||
log_select(rd_state->log);
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
rd_state->log_path = push_str8f(rd_state->arena, "%S/ui_thread.raddbg_log", g_logs_folder);
|
||||
write_data_to_file_path(rd_state->log_path, str8_zero());
|
||||
scratch_end(scratch);
|
||||
}
|
||||
rd_state->num_frames_requested = 2;
|
||||
rd_state->seconds_until_autosave = 0.5f;
|
||||
rd_state->eval_cache = e_cache_alloc();
|
||||
|
||||
@@ -532,7 +532,16 @@ entry_point(CmdLine *cmd_line)
|
||||
try_u64_from_str8_c_rules(jit_addr_string, &jit_addr);
|
||||
jit_attach = (jit_addr != 0);
|
||||
}
|
||||
|
||||
|
||||
// init log
|
||||
g_logs_folder = cmd_line_string(cmd_line, str8_lit("logs"));
|
||||
if(g_logs_folder.size == 0)
|
||||
{
|
||||
String8 user_program_data_path = get_process_info()->user_program_data_path;
|
||||
g_logs_folder = push_str8f(scratch.arena, "%S/%Sraddbg/logs", program_data_folder_prefix_from_os(OperatingSystem_CURRENT), user_program_data_path);
|
||||
}
|
||||
make_directory(g_logs_folder);
|
||||
|
||||
//- rjf: dispatch to top-level codepath based on execution mode
|
||||
switch(exec_mode)
|
||||
{
|
||||
@@ -863,6 +872,8 @@ entry_point(CmdLine *cmd_line)
|
||||
"This will launch the debugger in the non-graphical IPC mode, which is used to communicate with another running instance of the debugger. The debugger instance will launch, send the specified command, then immediately terminate. This may be used by editors or other programs to control the debugger.\n\n"
|
||||
"--gen_crash_dump\n"
|
||||
"Generate mini dump on crash.\n\n"
|
||||
"--logs:<path>\n"
|
||||
"Overrides default path to the folder with logs.\n"
|
||||
));
|
||||
}break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user