mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
remove unnecessary ctrl log flushes, which seriously bloated the ctrl thread running path
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ commands =
|
|||||||
.rjf_f1 =
|
.rjf_f1 =
|
||||||
{
|
{
|
||||||
//.win = "build rdi_from_pdb rdi_dump && pushd build && rdi_from_pdb --pdb:mule_main.pdb --out:mule_main.rdi && rdi_dump mule_main.rdi > mule_main.dump && popd",
|
//.win = "build rdi_from_pdb rdi_dump && pushd build && rdi_from_pdb --pdb:mule_main.pdb --out:mule_main.rdi && rdi_dump mule_main.rdi > mule_main.dump && popd",
|
||||||
.win = "build raddbg telemetry",
|
.win = "build raddbg telemetry release",
|
||||||
.linux = "",
|
.linux = "",
|
||||||
.out = "*compilation*",
|
.out = "*compilation*",
|
||||||
.footer_panel = true,
|
.footer_panel = true,
|
||||||
|
|||||||
+13
-10
@@ -3368,7 +3368,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
|||||||
DMN_EventNode *next_event_node = ctrl_state->first_dmn_event_node;
|
DMN_EventNode *next_event_node = ctrl_state->first_dmn_event_node;
|
||||||
|
|
||||||
// rjf: log event
|
// rjf: log event
|
||||||
if(next_event_node != 0) CTRL_CtrlThreadLogScope
|
if(next_event_node != 0)
|
||||||
{
|
{
|
||||||
DMN_Event *ev = &next_event_node->v;
|
DMN_Event *ev = &next_event_node->v;
|
||||||
log_infof("--- event ---\n");
|
log_infof("--- event ---\n");
|
||||||
@@ -3532,9 +3532,9 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
|||||||
// rjf: run for new events
|
// rjf: run for new events
|
||||||
ProfScope("run for new events")
|
ProfScope("run for new events")
|
||||||
{
|
{
|
||||||
CTRL_CtrlThreadLogScope log_infof("{dmn_ctrl_run ...");
|
log_infof("{dmn_ctrl_run ...");
|
||||||
DMN_EventList events = dmn_ctrl_run(scratch.arena, ctrl_ctx, run_ctrls);
|
DMN_EventList events = dmn_ctrl_run(scratch.arena, ctrl_ctx, run_ctrls);
|
||||||
CTRL_CtrlThreadLogScope log_infof("}\n");
|
log_infof("}\n");
|
||||||
for(DMN_EventNode *src_n = events.first; src_n != 0; src_n = src_n->next)
|
for(DMN_EventNode *src_n = events.first; src_n != 0; src_n = src_n->next)
|
||||||
{
|
{
|
||||||
DMN_EventNode *dst_n = ctrl_state->free_dmn_event_node;
|
DMN_EventNode *dst_n = ctrl_state->free_dmn_event_node;
|
||||||
@@ -4184,7 +4184,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
|||||||
B32 hard_stop = 0;
|
B32 hard_stop = 0;
|
||||||
CTRL_EventCause hard_stop_cause = ctrl_event_cause_from_dmn_event_kind(event->kind);
|
CTRL_EventCause hard_stop_cause = ctrl_event_cause_from_dmn_event_kind(event->kind);
|
||||||
B32 use_stepping_logic = 0;
|
B32 use_stepping_logic = 0;
|
||||||
CTRL_CtrlThreadLogScope switch(event->kind)
|
switch(event->kind)
|
||||||
{
|
{
|
||||||
default:{}break;
|
default:{}break;
|
||||||
case DMN_EventKind_Error:
|
case DMN_EventKind_Error:
|
||||||
@@ -4501,9 +4501,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
|||||||
B32 hit_trap_net_bp = 0;
|
B32 hit_trap_net_bp = 0;
|
||||||
B32 hit_conditional_bp_but_filtered = 0;
|
B32 hit_conditional_bp_but_filtered = 0;
|
||||||
CTRL_TrapFlags hit_trap_flags = 0;
|
CTRL_TrapFlags hit_trap_flags = 0;
|
||||||
if(!hard_stop && use_stepping_logic) CTRL_CtrlThreadLogScope
|
if(!hard_stop && use_stepping_logic && event->kind == DMN_EventKind_Breakpoint)
|
||||||
{
|
ProfScope("for breakpoint events, gather bp info")
|
||||||
if(event->kind == DMN_EventKind_Breakpoint)
|
|
||||||
{
|
{
|
||||||
Temp temp = temp_begin(scratch.arena);
|
Temp temp = temp_begin(scratch.arena);
|
||||||
String8List conditions = {0};
|
String8List conditions = {0};
|
||||||
@@ -4544,12 +4543,13 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: evaluate hit stop conditions
|
// rjf: evaluate hit stop conditions
|
||||||
if(conditions.node_count != 0)
|
if(conditions.node_count != 0) ProfScope("evaluate hit stop conditions")
|
||||||
{
|
{
|
||||||
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
|
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
|
||||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
|
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
|
||||||
for(String8Node *condition_n = conditions.first; condition_n != 0; condition_n = condition_n->next)
|
for(String8Node *condition_n = conditions.first; condition_n != 0; condition_n = condition_n->next)
|
||||||
{
|
{
|
||||||
|
ProfBegin("compile expression");
|
||||||
String8 string = condition_n->string;
|
String8 string = condition_n->string;
|
||||||
EVAL_ParseCtx parse_ctx = zero_struct;
|
EVAL_ParseCtx parse_ctx = zero_struct;
|
||||||
{
|
{
|
||||||
@@ -4582,8 +4582,9 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
|||||||
{
|
{
|
||||||
bytecode = eval_bytecode_from_oplist(scratch.arena, &op_list);
|
bytecode = eval_bytecode_from_oplist(scratch.arena, &op_list);
|
||||||
}
|
}
|
||||||
|
ProfEnd();
|
||||||
EVAL_Result eval = {0};
|
EVAL_Result eval = {0};
|
||||||
if(bytecode.size != 0)
|
if(bytecode.size != 0) ProfScope("evaluate expression")
|
||||||
{
|
{
|
||||||
U64 module_base = module->vaddr_range.min;
|
U64 module_base = module->vaddr_range.min;
|
||||||
U64 tls_base = dmn_tls_root_vaddr_from_thread(event->thread);
|
U64 tls_base = dmn_tls_root_vaddr_from_thread(event->thread);
|
||||||
@@ -4615,6 +4616,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rjf: gather trap net hits
|
// rjf: gather trap net hits
|
||||||
|
ProfScope("gather trap net hits")
|
||||||
|
{
|
||||||
if(!hit_user_bp && dmn_handle_match(event->process, target_process))
|
if(!hit_user_bp && dmn_handle_match(event->process, target_process))
|
||||||
{
|
{
|
||||||
for(CTRL_TrapNode *node = msg->traps.first;
|
for(CTRL_TrapNode *node = msg->traps.first;
|
||||||
@@ -4628,12 +4631,12 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log_infof(">>> stepping >>> stepping logic - BP event -> hit_user_bp: %i\n", hit_user_bp);
|
log_infof(">>> stepping >>> stepping logic - BP event -> hit_user_bp: %i\n", hit_user_bp);
|
||||||
log_infof(">>> stepping >>> stepping logic - BP event -> hit_entry: %i\n", hit_entry);
|
log_infof(">>> stepping >>> stepping logic - BP event -> hit_entry: %i\n", hit_entry);
|
||||||
temp_end(temp);
|
temp_end(temp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: hit conditional user bp but filtered -> single step
|
//- rjf: hit conditional user bp but filtered -> single step
|
||||||
B32 cond_bp_single_step_stop = 0;
|
B32 cond_bp_single_step_stop = 0;
|
||||||
|
|||||||
@@ -1342,7 +1342,9 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
|||||||
B32 any_processes_live = dmn_w32_shared->new_process_pending;
|
B32 any_processes_live = dmn_w32_shared->new_process_pending;
|
||||||
if(!any_processes_live)
|
if(!any_processes_live)
|
||||||
{
|
{
|
||||||
for(DMN_W32_Entity *process = dmn_w32_shared->entities_base->first; process != &dmn_w32_entity_nil; process = process->next)
|
for(DMN_W32_Entity *process = dmn_w32_shared->entities_base->first;
|
||||||
|
process != &dmn_w32_entity_nil;
|
||||||
|
process = process->next)
|
||||||
{
|
{
|
||||||
if(process->kind == DMN_W32_EntityKind_Process)
|
if(process->kind == DMN_W32_EntityKind_Process)
|
||||||
{
|
{
|
||||||
@@ -1382,7 +1384,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
|||||||
//////////////////////////
|
//////////////////////////
|
||||||
//- rjf: set single step bit
|
//- rjf: set single step bit
|
||||||
//
|
//
|
||||||
if(!dmn_handle_match(ctrls->single_step_thread, dmn_handle_zero()))
|
if(!dmn_handle_match(ctrls->single_step_thread, dmn_handle_zero())) ProfScope("set single step bit")
|
||||||
{
|
{
|
||||||
DMN_W32_Entity *thread = dmn_w32_entity_from_handle(ctrls->single_step_thread);
|
DMN_W32_Entity *thread = dmn_w32_entity_from_handle(ctrls->single_step_thread);
|
||||||
Architecture arch = thread->arch;
|
Architecture arch = thread->arch;
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ r_init(CmdLine *cmdln)
|
|||||||
r_d3d11_state->device_rw_mutex = os_rw_mutex_alloc();
|
r_d3d11_state->device_rw_mutex = os_rw_mutex_alloc();
|
||||||
|
|
||||||
//- rjf: create base device
|
//- rjf: create base device
|
||||||
|
ProfBegin("create base device");
|
||||||
UINT creation_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
UINT creation_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||||
#if BUILD_DEBUG
|
#if BUILD_DEBUG
|
||||||
if(cmd_line_has_flag(cmdln, str8_lit("d3d11_debug")))
|
if(cmd_line_has_flag(cmdln, str8_lit("d3d11_debug")))
|
||||||
@@ -199,7 +200,6 @@ r_init(CmdLine *cmdln)
|
|||||||
D3D11_SDK_VERSION,
|
D3D11_SDK_VERSION,
|
||||||
&r_d3d11_state->base_device, 0, &r_d3d11_state->base_device_ctx);
|
&r_d3d11_state->base_device, 0, &r_d3d11_state->base_device_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FAILED(error))
|
if(FAILED(error))
|
||||||
{
|
{
|
||||||
char buffer[256] = {0};
|
char buffer[256] = {0};
|
||||||
@@ -207,10 +207,11 @@ r_init(CmdLine *cmdln)
|
|||||||
os_graphical_message(1, str8_lit("Fatal Error"), str8_cstring(buffer));
|
os_graphical_message(1, str8_lit("Fatal Error"), str8_cstring(buffer));
|
||||||
os_exit_process(1);
|
os_exit_process(1);
|
||||||
}
|
}
|
||||||
|
ProfEnd();
|
||||||
|
|
||||||
//- rjf: enable break-on-error
|
//- rjf: enable break-on-error
|
||||||
#if BUILD_DEBUG
|
#if BUILD_DEBUG
|
||||||
if(cmd_line_has_flag(cmdln, str8_lit("d3d11_debug")))
|
if(cmd_line_has_flag(cmdln, str8_lit("d3d11_debug"))) ProfScope("enable break-on-error")
|
||||||
{
|
{
|
||||||
ID3D11InfoQueue *info = 0;
|
ID3D11InfoQueue *info = 0;
|
||||||
error = r_d3d11_state->base_device->lpVtbl->QueryInterface(r_d3d11_state->base_device, &IID_ID3D11InfoQueue, (void **)(&info));
|
error = r_d3d11_state->base_device->lpVtbl->QueryInterface(r_d3d11_state->base_device, &IID_ID3D11InfoQueue, (void **)(&info));
|
||||||
@@ -224,15 +225,20 @@ r_init(CmdLine *cmdln)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//- rjf: get main device
|
//- rjf: get main device
|
||||||
|
ProfBegin("get main device");
|
||||||
error = r_d3d11_state->base_device->lpVtbl->QueryInterface(r_d3d11_state->base_device, &IID_ID3D11Device1, (void **)(&r_d3d11_state->device));
|
error = r_d3d11_state->base_device->lpVtbl->QueryInterface(r_d3d11_state->base_device, &IID_ID3D11Device1, (void **)(&r_d3d11_state->device));
|
||||||
error = r_d3d11_state->base_device_ctx->lpVtbl->QueryInterface(r_d3d11_state->base_device_ctx, &IID_ID3D11DeviceContext1, (void **)(&r_d3d11_state->device_ctx));
|
error = r_d3d11_state->base_device_ctx->lpVtbl->QueryInterface(r_d3d11_state->base_device_ctx, &IID_ID3D11DeviceContext1, (void **)(&r_d3d11_state->device_ctx));
|
||||||
|
ProfEnd();
|
||||||
|
|
||||||
//- rjf: get dxgi device/adapter/factory
|
//- rjf: get dxgi device/adapter/factory
|
||||||
|
ProfBegin("get dxgi device/adapter/factory");
|
||||||
error = r_d3d11_state->device->lpVtbl->QueryInterface(r_d3d11_state->device, &IID_IDXGIDevice1, (void **)(&r_d3d11_state->dxgi_device));
|
error = r_d3d11_state->device->lpVtbl->QueryInterface(r_d3d11_state->device, &IID_IDXGIDevice1, (void **)(&r_d3d11_state->dxgi_device));
|
||||||
error = r_d3d11_state->dxgi_device->lpVtbl->GetAdapter(r_d3d11_state->dxgi_device, &r_d3d11_state->dxgi_adapter);
|
error = r_d3d11_state->dxgi_device->lpVtbl->GetAdapter(r_d3d11_state->dxgi_device, &r_d3d11_state->dxgi_adapter);
|
||||||
error = r_d3d11_state->dxgi_adapter->lpVtbl->GetParent(r_d3d11_state->dxgi_adapter, &IID_IDXGIFactory2, (void **)(&r_d3d11_state->dxgi_factory));
|
error = r_d3d11_state->dxgi_adapter->lpVtbl->GetParent(r_d3d11_state->dxgi_adapter, &IID_IDXGIFactory2, (void **)(&r_d3d11_state->dxgi_factory));
|
||||||
|
ProfEnd();
|
||||||
|
|
||||||
//- rjf: create main rasterizer
|
//- rjf: create main rasterizer
|
||||||
|
ProfScope("create main rasterizer")
|
||||||
{
|
{
|
||||||
D3D11_RASTERIZER_DESC1 desc = {D3D11_FILL_SOLID};
|
D3D11_RASTERIZER_DESC1 desc = {D3D11_FILL_SOLID};
|
||||||
{
|
{
|
||||||
@@ -244,6 +250,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: create main blend state
|
//- rjf: create main blend state
|
||||||
|
ProfScope("create main blend state")
|
||||||
{
|
{
|
||||||
D3D11_BLEND_DESC desc = {0};
|
D3D11_BLEND_DESC desc = {0};
|
||||||
{
|
{
|
||||||
@@ -259,6 +266,8 @@ r_init(CmdLine *cmdln)
|
|||||||
error = r_d3d11_state->device->lpVtbl->CreateBlendState(r_d3d11_state->device, &desc, &r_d3d11_state->main_blend_state);
|
error = r_d3d11_state->device->lpVtbl->CreateBlendState(r_d3d11_state->device, &desc, &r_d3d11_state->main_blend_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- rjf: create empty blend state
|
||||||
|
ProfScope("create empty blend state")
|
||||||
{
|
{
|
||||||
D3D11_BLEND_DESC desc = {0};
|
D3D11_BLEND_DESC desc = {0};
|
||||||
{
|
{
|
||||||
@@ -269,6 +278,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: create nearest-neighbor sampler
|
//- rjf: create nearest-neighbor sampler
|
||||||
|
ProfScope("create nearest-neighbor sampler")
|
||||||
{
|
{
|
||||||
D3D11_SAMPLER_DESC desc = zero_struct;
|
D3D11_SAMPLER_DESC desc = zero_struct;
|
||||||
{
|
{
|
||||||
@@ -282,6 +292,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: create bilinear sampler
|
//- rjf: create bilinear sampler
|
||||||
|
ProfScope("create bilinear sampler")
|
||||||
{
|
{
|
||||||
D3D11_SAMPLER_DESC desc = zero_struct;
|
D3D11_SAMPLER_DESC desc = zero_struct;
|
||||||
{
|
{
|
||||||
@@ -295,6 +306,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: create noop depth/stencil state
|
//- rjf: create noop depth/stencil state
|
||||||
|
ProfScope("create noop depth/stencil state")
|
||||||
{
|
{
|
||||||
D3D11_DEPTH_STENCIL_DESC desc = {0};
|
D3D11_DEPTH_STENCIL_DESC desc = {0};
|
||||||
{
|
{
|
||||||
@@ -306,6 +318,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: create plain depth/stencil state
|
//- rjf: create plain depth/stencil state
|
||||||
|
ProfScope("create plain depth/stencil state")
|
||||||
{
|
{
|
||||||
D3D11_DEPTH_STENCIL_DESC desc = {0};
|
D3D11_DEPTH_STENCIL_DESC desc = {0};
|
||||||
{
|
{
|
||||||
@@ -317,6 +330,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: create buffers
|
//- rjf: create buffers
|
||||||
|
ProfScope("create buffers")
|
||||||
{
|
{
|
||||||
D3D11_BUFFER_DESC desc = {0};
|
D3D11_BUFFER_DESC desc = {0};
|
||||||
{
|
{
|
||||||
@@ -329,6 +343,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: build vertex shaders & input layouts
|
//- rjf: build vertex shaders & input layouts
|
||||||
|
ProfScope("build vertex shaders & input layouts")
|
||||||
for(R_D3D11_VShadKind kind = (R_D3D11_VShadKind)0;
|
for(R_D3D11_VShadKind kind = (R_D3D11_VShadKind)0;
|
||||||
kind < R_D3D11_VShadKind_COUNT;
|
kind < R_D3D11_VShadKind_COUNT;
|
||||||
kind = (R_D3D11_VShadKind)(kind+1))
|
kind = (R_D3D11_VShadKind)(kind+1))
|
||||||
@@ -342,6 +357,7 @@ r_init(CmdLine *cmdln)
|
|||||||
ID3DBlob *vshad_source_blob = 0;
|
ID3DBlob *vshad_source_blob = 0;
|
||||||
ID3DBlob *vshad_source_errors = 0;
|
ID3DBlob *vshad_source_errors = 0;
|
||||||
ID3D11VertexShader *vshad = 0;
|
ID3D11VertexShader *vshad = 0;
|
||||||
|
ProfScope("compile vertex shader")
|
||||||
{
|
{
|
||||||
error = D3DCompile(source.str,
|
error = D3DCompile(source.str,
|
||||||
source.size,
|
source.size,
|
||||||
@@ -396,6 +412,7 @@ r_init(CmdLine *cmdln)
|
|||||||
ID3DBlob *pshad_source_blob = 0;
|
ID3DBlob *pshad_source_blob = 0;
|
||||||
ID3DBlob *pshad_source_errors = 0;
|
ID3DBlob *pshad_source_errors = 0;
|
||||||
ID3D11PixelShader *pshad = 0;
|
ID3D11PixelShader *pshad = 0;
|
||||||
|
ProfScope("compile pixel shader")
|
||||||
{
|
{
|
||||||
error = D3DCompile(source.str,
|
error = D3DCompile(source.str,
|
||||||
source.size,
|
source.size,
|
||||||
@@ -428,6 +445,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: build uniform type buffers
|
//- rjf: build uniform type buffers
|
||||||
|
ProfScope("build uniform type buffers")
|
||||||
for(R_D3D11_UniformTypeKind kind = (R_D3D11_UniformTypeKind)0;
|
for(R_D3D11_UniformTypeKind kind = (R_D3D11_UniformTypeKind)0;
|
||||||
kind < R_D3D11_UniformTypeKind_COUNT;
|
kind < R_D3D11_UniformTypeKind_COUNT;
|
||||||
kind = (R_D3D11_UniformTypeKind)(kind+1))
|
kind = (R_D3D11_UniformTypeKind)(kind+1))
|
||||||
@@ -449,6 +467,7 @@ r_init(CmdLine *cmdln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: create backup texture
|
//- rjf: create backup texture
|
||||||
|
ProfScope("create backup texture")
|
||||||
{
|
{
|
||||||
U32 backup_texture_data[] =
|
U32 backup_texture_data[] =
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user