mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-15 02:30:11 -08:00
dbg_engine: process memory cache - always retry on memgen 'tearing', do not enforce size restriction. linux_demon: correctly relativize loaded module paths when needed per the loading process' working directory. raddbg: disasm view, do not skip too far back - can go into unmapped space. eval: file/folder filtering - hoist exact matches to the top.
This commit is contained in:
1 parent
e7a9c430f8
commit
4e7a6127d8
8 files changed
+41
-14
No files matched your search
+1
-1
@@ -35,6 +35,7 @@ target:
|
||||
executable: "build/raddbg"
|
||||
working_directory: build
|
||||
arguments: "--user:raddbg_test.user"
|
||||
enabled: 1
|
||||
}
|
||||
target:
|
||||
{
|
||||
@@ -45,5 +46,4 @@ target:
|
||||
{
|
||||
executable: "../jai/examples/invaders/invaders"
|
||||
working_directory: "../jai/examples/invaders"
|
||||
enabled: 1
|
||||
}
|
||||
@@ -2782,7 +2782,6 @@ d_ctrl_thread__close_dump_process(D_MsgID msg_id, D_Handle process)
|
||||
evt->kind = D_EventKind_EndModule;
|
||||
evt->msg_id = msg_id;
|
||||
evt->entity = node->modules[idx].module_handle;
|
||||
evt->string = node->modules[idx].path;
|
||||
d_c2u_push_events(&evts);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
@@ -3335,7 +3334,6 @@ d_ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, D_Msg *msg, D
|
||||
|
||||
//- rjf: unload module
|
||||
case DMN_EventKind_UnloadModule:
|
||||
ProfScope("unload module %.*s", str8_varg(event->string))
|
||||
{
|
||||
//- rjf: unpack module
|
||||
D_Handle module_handle = d_handle_from_dmn(D_MachineID_Local, event->module);
|
||||
@@ -3360,7 +3358,6 @@ d_ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, D_Msg *msg, D
|
||||
out_evt->kind = D_EventKind_EndModule;
|
||||
out_evt->msg_id = msg->msg_id;
|
||||
out_evt->entity = module_handle;
|
||||
out_evt->string = module_path;
|
||||
|
||||
//- rjf: close debug info
|
||||
DI_Key dbgi_key = d_dbgi_key_from_module(module_ent);
|
||||
@@ -6103,8 +6100,8 @@ d_memory_artifact_create(String8 key, B32 *cancel_signal, AC_Status *status_out,
|
||||
arena_release(range_arena);
|
||||
}
|
||||
|
||||
//- rjf: retry on mem gen "tearing", and if the range is non-empty
|
||||
if(pre_read_mem_gen != post_read_mem_gen && range_size != 0)
|
||||
//- rjf: retry on mem gen "tearing"
|
||||
if(pre_read_mem_gen != post_read_mem_gen)
|
||||
{
|
||||
status_out[0] = AC_Status_NeedRetry;
|
||||
}
|
||||
|
||||
+16
-2
@@ -3111,11 +3111,25 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(folder)
|
||||
{
|
||||
if(info.props.flags & FilePropertyFlag_IsFolder)
|
||||
{
|
||||
str8_list_push(scratch.arena, &folder_paths, str8_copy(arena, info.name));
|
||||
if(str8_match(info.name, local_filter, 0))
|
||||
{
|
||||
str8_list_push_front(scratch.arena, &folder_paths, str8_copy(arena, info.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
str8_list_push(scratch.arena, &folder_paths, str8_copy(arena, info.name));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
str8_list_push(scratch.arena, &file_paths, str8_copy(arena, info.name));
|
||||
if(str8_match(info.name, local_filter, 0))
|
||||
{
|
||||
str8_list_push_front(scratch.arena, &file_paths, str8_copy(arena, info.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
str8_list_push(scratch.arena, &file_paths, str8_copy(arena, info.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <dirent.h>
|
||||
#include <dlfcn.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <execinfo.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -302,6 +302,24 @@ lnx_dmn_module_info_from_process_module(Arena *arena, pid_t pid, int memory_fd,
|
||||
//- rjf: read module path
|
||||
String8 module_path = lnx_dmn_read_string(arena, memory_fd, name_vaddr);
|
||||
|
||||
//- rjf: if the module path is relative, we need to convert to absolute using the
|
||||
// process' current working directory. the process' working directory may, of course,
|
||||
// change across time, and so we need to re-read it every time we encounter this
|
||||
// scenario.
|
||||
if(path_style_from_str8(module_path) == PathStyle_Relative)
|
||||
{
|
||||
char *process_cwd_path_name = (char *)str8f(scratch.arena, "/proc/%d/cwd", pid).str;
|
||||
U64 read_cap = PATH_MAX;
|
||||
U8 *read_buffer = push_array(scratch.arena, U8, read_cap);
|
||||
ssize_t read_size = readlink(process_cwd_path_name, (char *)read_buffer, read_cap);
|
||||
if(read_size != 0)
|
||||
{
|
||||
String8 process_cwd = str8(read_buffer, read_size);
|
||||
String8 module_path_absolute = str8f(scratch.arena, "%S/%S", process_cwd, module_path);
|
||||
module_path = path_normalized_from_string(arena, module_path_absolute);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: decide on debug info key info
|
||||
String8 debug_info_path = module_path;
|
||||
Guid debug_info_guid = {0};
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
//~ rjf: linux TODO notes
|
||||
//
|
||||
// initial alpha:
|
||||
// [x] .so loading/debugging - missing debug info
|
||||
// [x] missing disasm
|
||||
// [ ] control
|
||||
// [ ] multithreaded stepping - trap hits reported on other threads.
|
||||
// [ ] stale memory - things evaluating to stale values that are definitely not zero
|
||||
|
||||
@@ -2720,13 +2720,13 @@ RD_VIEW_UI_FUNCTION_DEF(disasm)
|
||||
{
|
||||
auto_selected = 1;
|
||||
auto_space = rd_eval_space_from_ctrl_entity(d_entity_from_handle(dv->temp_look_process), D_EvalSpaceKind_Entity);
|
||||
eval = e_eval_from_stringf("(0x%I64x & (~(0x4000 - 1)))", dv->temp_look_vaddr);
|
||||
eval = e_eval_from_stringf("(0x%I64x & (~(0x1000 - 1)))", dv->temp_look_vaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto_selected = 1;
|
||||
auto_space = rd_eval_space_from_ctrl_entity(d_entity_from_handle(rd_regs()->process), D_EvalSpaceKind_Entity);
|
||||
eval = e_eval_from_stringf("(reg:rip & (~(0x4000 - 1)))");
|
||||
eval = e_eval_from_stringf("(reg:rip & (~(0x1000 - 1)))");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2228,7 +2228,6 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
e->kind = DMN_EventKind_UnloadModule;
|
||||
e->process = w32_dmn_handle_from_entity(process);
|
||||
e->module = w32_dmn_handle_from_entity(child);
|
||||
e->string = w32_dmn_full_path_from_module(arena, child);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -2393,7 +2392,6 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
e->kind = DMN_EventKind_UnloadModule;
|
||||
e->process = w32_dmn_handle_from_entity(process);
|
||||
e->module = w32_dmn_handle_from_entity(module);
|
||||
e->string = w32_dmn_full_path_from_module(arena, module);
|
||||
}
|
||||
|
||||
// rjf: release entity storage
|
||||
@@ -3145,7 +3143,6 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
e->kind = DMN_EventKind_UnloadModule;
|
||||
e->process = w32_dmn_handle_from_entity(process);
|
||||
e->module = w32_dmn_handle_from_entity(child);
|
||||
e->string = w32_dmn_full_path_from_module(arena, child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user