mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-19 02:22:23 -07:00
trap net generation logging; log markers
This commit is contained in:
+9
-15
@@ -3319,7 +3319,7 @@ ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Hand
|
||||
}
|
||||
|
||||
internal void
|
||||
ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8 path)
|
||||
ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module)
|
||||
{
|
||||
//////////////////////////////
|
||||
//- rjf: evict module image info from cache
|
||||
@@ -3348,19 +3348,6 @@ ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: close debug info
|
||||
//
|
||||
{
|
||||
CTRL_Entity *module_ent = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, machine_id, module);
|
||||
CTRL_Entity *debug_info_path_ent = ctrl_entity_child_from_kind(module_ent, CTRL_EntityKind_DebugInfoPath);
|
||||
if(debug_info_path_ent != &ctrl_entity_nil)
|
||||
{
|
||||
DI_Key dbgi_key = {debug_info_path_ent->string, debug_info_path_ent->timestamp};
|
||||
di_close(&dbgi_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: attached process running/event gathering
|
||||
@@ -3675,12 +3662,19 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
{
|
||||
CTRL_Event *out_evt = ctrl_event_list_push(scratch.arena, &evts);
|
||||
String8 module_path = event->string;
|
||||
ctrl_thread__module_close(CTRL_MachineID_Local, event->module, module_path);
|
||||
ctrl_thread__module_close(CTRL_MachineID_Local, event->module);
|
||||
out_evt->kind = CTRL_EventKind_EndModule;
|
||||
out_evt->msg_id = msg->msg_id;
|
||||
out_evt->machine_id = CTRL_MachineID_Local;
|
||||
out_evt->entity = event->module;
|
||||
out_evt->string = module_path;
|
||||
CTRL_Entity *module_ent = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, CTRL_MachineID_Local, event->module);
|
||||
CTRL_Entity *debug_info_path_ent = ctrl_entity_child_from_kind(module_ent, CTRL_EntityKind_DebugInfoPath);
|
||||
if(debug_info_path_ent != &ctrl_entity_nil)
|
||||
{
|
||||
DI_Key dbgi_key = {debug_info_path_ent->string, debug_info_path_ent->timestamp};
|
||||
di_close(&dbgi_key);
|
||||
}
|
||||
}break;
|
||||
case DMN_EventKind_DebugString:
|
||||
{
|
||||
|
||||
@@ -810,7 +810,7 @@ internal void ctrl_thread__append_resolved_process_user_bp_traps(Arena *arena, C
|
||||
|
||||
//- rjf: module lifetime open/close work
|
||||
internal void ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Handle module, Rng1U64 vaddr_range, String8 path);
|
||||
internal void ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8 path);
|
||||
internal void ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module);
|
||||
|
||||
//- rjf: attached process running/event gathering
|
||||
internal DMN_Event *ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, DMN_RunCtrls *run_ctrls, CTRL_Spoof *spoof);
|
||||
|
||||
+43
-3
@@ -879,7 +879,7 @@ df_ctrl_flow_info_from_vaddr_code__x64(Arena *arena, DF_InstFlags exit_points_ma
|
||||
point.jump_dest_vaddr = (U64)(point.vaddr + (S64)((S32)inst.rel_voff));
|
||||
}
|
||||
DF_CtrlFlowPointNode *node = push_array(arena, DF_CtrlFlowPointNode, 1);
|
||||
node->point = point;
|
||||
node->v = point;
|
||||
SLLQueuePush(info.exit_points.first, info.exit_points.last, node);
|
||||
info.exit_points.count += 1;
|
||||
}
|
||||
@@ -2851,6 +2851,7 @@ internal CTRL_TrapList
|
||||
df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
log_infof("step_over_line:\n{\n");
|
||||
CTRL_TrapList result = {0};
|
||||
|
||||
// rjf: thread => info
|
||||
@@ -2859,6 +2860,8 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
DI_Key dbgi_key = df_dbgi_key_from_module(module);
|
||||
Architecture arch = df_architecture_from_entity(thread);
|
||||
U64 ip_vaddr = ctrl_query_cached_rip_from_thread(df_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
|
||||
log_infof(" ip_vaddr: 0x%I64x\n", ip_vaddr);
|
||||
log_infof(" dbgi_key: {%S, 0x%I64x}\n", dbgi_key.path, dbgi_key.min_timestamp);
|
||||
|
||||
// rjf: ip => line vaddr range
|
||||
Rng1U64 line_vaddr_rng = {0};
|
||||
@@ -2870,6 +2873,8 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
{
|
||||
line_vaddr_rng = df_vaddr_range_from_voff_range(module, line_voff_rng);
|
||||
}
|
||||
log_infof(" line: {%S:%I64i}\n", line_info.file->name, line_info.pt.line);
|
||||
log_infof(" voff_range: {0x%I64x, 0x%I64x}\n", line_info.voff_range.min, line_info.voff_range.max);
|
||||
}
|
||||
|
||||
// rjf: opl line_vaddr_rng -> 0xf00f00 or 0xfeefee? => include in line vaddr range
|
||||
@@ -2894,6 +2899,25 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
{
|
||||
CTRL_ProcessMemorySlice machine_code_slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, line_vaddr_rng, os_now_microseconds()+50000);
|
||||
machine_code = machine_code_slice.data;
|
||||
log_infof(" machine_code_slice:\n {\n");
|
||||
log_infof(" stale: %i\n", machine_code_slice.stale);
|
||||
log_infof(" any_byte_bad: %i\n", machine_code_slice.any_byte_bad);
|
||||
log_infof(" any_byte_changed: %i\n", machine_code_slice.any_byte_changed);
|
||||
log_infof(" [\n");
|
||||
for(U64 idx = 0; idx < machine_code_slice.data.size; idx += 1)
|
||||
{
|
||||
if(idx%16 == 0)
|
||||
{
|
||||
log_infof(" ");
|
||||
}
|
||||
log_infof("0x%x,", machine_code_slice.data.str[idx]);
|
||||
if(idx%16 == 15 || idx+1 == machine_code_slice.data.size)
|
||||
{
|
||||
log_infof("\n");
|
||||
}
|
||||
}
|
||||
log_infof(" ]\n");
|
||||
log_infof(" }\n");
|
||||
}
|
||||
|
||||
// rjf: machine code => ctrl flow analysis
|
||||
@@ -2909,12 +2933,21 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
arch,
|
||||
line_vaddr_rng.min,
|
||||
machine_code);
|
||||
log_infof(" ctrl_flow_info:\n {\n");
|
||||
log_infof(" flags: %x\n", ctrl_flow_info.flags);
|
||||
log_infof(" exit_points:\n {\n");
|
||||
for(DF_CtrlFlowPointNode *n = ctrl_flow_info.exit_points.first; n != 0; n = n->next)
|
||||
{
|
||||
log_infof(" {vaddr:0x%I64x, jump_dest_vaddr:0x%I64x, expected_sp_delta:0x%I64x, inst_flags:%x}\n", n->v.vaddr, n->v.jump_dest_vaddr, n->v.expected_sp_delta, n->v.inst_flags);
|
||||
}
|
||||
log_infof(" }\n");
|
||||
log_infof(" }\n");
|
||||
}
|
||||
|
||||
// rjf: push traps for all exit points
|
||||
if(good_line_info) for(DF_CtrlFlowPointNode *n = ctrl_flow_info.exit_points.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_CtrlFlowPoint *point = &n->point;
|
||||
DF_CtrlFlowPoint *point = &n->v;
|
||||
CTRL_TrapFlags flags = 0;
|
||||
B32 add = 1;
|
||||
U64 trap_addr = point->vaddr;
|
||||
@@ -2969,6 +3002,7 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
log_infof("}\n\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3039,7 +3073,7 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread)
|
||||
// rjf: push traps for all exit points
|
||||
if(good_line_info) for(DF_CtrlFlowPointNode *n = ctrl_flow_info.exit_points.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_CtrlFlowPoint *point = &n->point;
|
||||
DF_CtrlFlowPoint *point = &n->v;
|
||||
CTRL_TrapFlags flags = 0;
|
||||
B32 add = 1;
|
||||
U64 trap_addr = point->vaddr;
|
||||
@@ -8948,6 +8982,12 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Error));
|
||||
#endif
|
||||
}break;
|
||||
|
||||
//- rjf: developer commands
|
||||
case DF_CoreCmdKind_LogMarker:
|
||||
{
|
||||
log_infof("\n\n--- #marker ---\n\n");
|
||||
}break;
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
|
||||
@@ -223,7 +223,7 @@ typedef struct DF_CtrlFlowPointNode DF_CtrlFlowPointNode;
|
||||
struct DF_CtrlFlowPointNode
|
||||
{
|
||||
DF_CtrlFlowPointNode *next;
|
||||
DF_CtrlFlowPoint point;
|
||||
DF_CtrlFlowPoint v;
|
||||
};
|
||||
|
||||
typedef struct DF_CtrlFlowPointList DF_CtrlFlowPointList;
|
||||
|
||||
@@ -412,6 +412,7 @@ DF_CoreCmdTable:// | | |
|
||||
|
||||
//- rjf: developer commands
|
||||
{ToggleDevMenu 0 Null Nil 0 0 0 0 0 0 Null "toggle_dev_menu" "Toggle Developer Menu" "Opens and closes the developer menu." "" }
|
||||
{LogMarker 0 Null Nil 0 0 0 0 0 0 Null "log_marker" "Log Marker" "Logs a marker in the application log, to denote specific points in time within the log." "" }
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -214,7 +214,7 @@ DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind_Null,
|
||||
};
|
||||
|
||||
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
|
||||
DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[222] =
|
||||
{
|
||||
{ str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
|
||||
@@ -437,6 +437,7 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] =
|
||||
{ str8_lit_comp("complete_query"), str8_lit_comp("Completes a query."), str8_lit_comp(""), str8_lit_comp("Complete Query"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("cancel_query"), str8_lit_comp("Cancels a query."), str8_lit_comp(""), str8_lit_comp("Cancel Query"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("toggle_dev_menu"), str8_lit_comp("Opens and closes the developer menu."), str8_lit_comp(""), str8_lit_comp("Toggle Developer Menu"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("log_marker"), str8_lit_comp("Logs a marker in the application log, to denote specific points in time within the log."), str8_lit_comp(""), str8_lit_comp("Log Marker"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
};
|
||||
|
||||
DF_CoreViewRuleSpecInfo df_g_core_view_rule_spec_info_table[17] =
|
||||
|
||||
@@ -269,6 +269,7 @@ DF_CoreCmdKind_PickFileOrFolder,
|
||||
DF_CoreCmdKind_CompleteQuery,
|
||||
DF_CoreCmdKind_CancelQuery,
|
||||
DF_CoreCmdKind_ToggleDevMenu,
|
||||
DF_CoreCmdKind_LogMarker,
|
||||
DF_CoreCmdKind_COUNT,
|
||||
} DF_CoreCmdKind;
|
||||
|
||||
|
||||
@@ -171,6 +171,9 @@ DF_DefaultBindingTable:
|
||||
|
||||
//- rjf: command lister
|
||||
{ "run_command" F1 0 0 0 }
|
||||
|
||||
//- rjf: developer commands
|
||||
{ "log_marker" M ctrl shift alt }
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -598,7 +598,7 @@ str8_lit_comp("goto_name"),
|
||||
str8_lit_comp("function_breakpoint"),
|
||||
};
|
||||
|
||||
DF_StringBindingPair df_g_default_binding_table[104] =
|
||||
DF_StringBindingPair df_g_default_binding_table[105] =
|
||||
{
|
||||
{str8_lit_comp("kill_all"), {OS_Key_F5, 0 |OS_EventFlag_Shift }},
|
||||
{str8_lit_comp("step_into_inst"), {OS_Key_F11, 0 |OS_EventFlag_Alt}},
|
||||
@@ -704,6 +704,7 @@ DF_StringBindingPair df_g_default_binding_table[104] =
|
||||
{str8_lit_comp("attach"), {OS_Key_F6, 0 |OS_EventFlag_Shift }},
|
||||
{str8_lit_comp("filter"), {OS_Key_Slash, 0 |OS_EventFlag_Ctrl }},
|
||||
{str8_lit_comp("run_command"), {OS_Key_F1, 0 }},
|
||||
{str8_lit_comp("log_marker"), {OS_Key_M, 0 |OS_EventFlag_Ctrl |OS_EventFlag_Shift |OS_EventFlag_Alt}},
|
||||
};
|
||||
|
||||
String8 df_g_binding_version_remap_old_name_table[5] =
|
||||
|
||||
@@ -290,7 +290,7 @@ extern Vec4F32* df_g_theme_preset_colors_table[9];
|
||||
extern DF_CmdParamSlot df_g_cmd_param_slot_2_view_spec_src_map[7];
|
||||
extern String8 df_g_cmd_param_slot_2_view_spec_dst_map[7];
|
||||
extern String8 df_g_cmd_param_slot_2_view_spec_cmd_map[7];
|
||||
extern DF_StringBindingPair df_g_default_binding_table[104];
|
||||
extern DF_StringBindingPair df_g_default_binding_table[105];
|
||||
extern String8 df_g_binding_version_remap_old_name_table[5];
|
||||
extern String8 df_g_binding_version_remap_new_name_table[5];
|
||||
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31];
|
||||
|
||||
Reference in New Issue
Block a user