exception code filter project settings / ui

This commit is contained in:
Ryan Fleury
2025-04-26 14:50:49 -07:00
parent 2092f5ca69
commit 6a7420b7aa
5 changed files with 173 additions and 56 deletions
+15
View File
@@ -2524,6 +2524,19 @@ jit_stepping_tests(void)
////////////////////////////////
// NOTE(allen): Exception Stepping
static void
exception_filter_test(void)
{
__try
{
RaiseException(0xc0000095, 0, 0, 0);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
OutputDebugStringA("did an exception\n");
}
}
int *global_null_read_pointer = 0;
static void
trip(void){
@@ -2805,6 +2818,8 @@ mule_main(int argc, char** argv)
fancy_viz_eval_tests();
exception_filter_test();
markup_tests();
// NOTE(allen): Stepping Tests
File diff suppressed because one or more lines are too long
+78
View File
@@ -258,12 +258,90 @@ RD_VocabTable:
}
```
}
// TODO(rjf): the control codes could be fed from the CTRL_ExceptionCodeKindTable, but
// we do not support that in this generator - we'd need a way to form a table-generated
// string and put it into a table cell...
{
project
```
x:
{
@default(2) @display_name('Project Tab Width') 'tab_width': @range[1, 32] u64,
@default(1) @display_name("Break On Win32 Control-C Exceptions") @description("Code: 0x40010005")
win32_ctrl_c: bool;
@default(1) @display_name("Break On Win32 Control-Break Exceptions") @description("Code: 0x40010008")
win32_ctrl_break: bool;
@default(0) @display_name("Break On Win32 WinRT Originate Error Exceptions") @description("Code: 0x40080201")
win32_win_rt_originate_error: bool;
@default(0) @display_name("Break On Win32 WinRT Transform Error Exceptions") @description("Code: 0x40080202")
win32_win_rt_transform_error: bool;
@default(0) @display_name("Break On Win32 RPC Call Cancelled Exceptions") @description("Code: 0x0000071a")
win32_rpc_call_cancelled: bool;
@default(0) @display_name("Break On Win32 Data Type Misalignment Exceptions") @description("Code: 0x80000002")
win32_datatype_misalignment: bool;
@default(1) @display_name("Break On Win32 Access Violation Exceptions") @description("Code: 0xc0000005")
win32_access_violation: bool;
@default(0) @display_name("Break On Win32 In Page Error Exceptions") @description("Code: 0xc0000006")
win32_in_page_error: bool;
@default(1) @display_name("Break On Win32 Invalid Handle Specified Exceptions") @description("Code: 0xc0000008")
win32_invalid_handle: bool;
@default(0) @display_name("Break On Win32 Not Enough Quota Exceptions") @description("Code: 0xc0000017")
win32_not_enough_quota: bool;
@default(0) @display_name("Break On Win32 Illegal Instruction Exceptions") @description("Code: 0xc000001d")
win32_illegal_instruction: bool;
@default(0) @display_name("Break On Win32 Cannot Continue From Exception Exceptions") @description("Code: 0xc0000025")
win32_cannot_continue_exception: bool;
@default(0) @display_name("Break On Win32 Invalid Exception Disposition Returned By Handler Exceptions") @description("Code: 0xc0000026")
win32_invalid_exception_disposition: bool;
@default(0) @display_name("Break On Win32 Array Bounds Exceeded Exceptions") @description("Code: 0xc000008c")
win32_array_bounds_exceeded: bool;
@default(0) @display_name("Break On Win32 Floating-Point Denormal Operand Exceptions") @description("Code: 0xc000008d")
win32_floating_point_denormal_operand: bool;
@default(0) @display_name("Break On Win32 Floating-Point Division By Zero Exceptions") @description("Code: 0xc000008e")
win32_floating_point_division_by_zero: bool;
@default(0) @display_name("Break On Win32 Floating-Point Inexact Result Exceptions") @description("Code: 0xc000008f")
win32_floating_point_inexact_result: bool;
@default(0) @display_name("Break On Win32 Floating-Point Invalid Operation Exceptions") @description("Code: 0xc0000090")
win32_floating_point_invalid_operation: bool;
@default(0) @display_name("Break On Win32 Floating-Point Overflow Exceptions") @description("Code: 0xc0000091")
win32_floating_point_overflow: bool;
@default(0) @display_name("Break On Win32 Floating-Point Stack Check Exceptions") @description("Code: 0xc0000092")
win32_floating_point_stack_check: bool;
@default(0) @display_name("Break On Win32 Floating-Point Underflow Exceptions") @description("Code: 0xc0000093")
win32_floating_point_underflow: bool;
@default(0) @display_name("Break On Win32 Integer Division By Zero Exceptions") @description("Code: 0xc0000094")
win32_integer_division_by_zero: bool;
@default(0) @display_name("Break On Win32 Integer Overflow Exceptions") @description("Code: 0xc0000095")
win32_integer_overflow: bool;
@default(0) @display_name("Break On Win32 Privileged Instruction Exceptions") @description("Code: 0xc0000096")
win32_privileged_instruction: bool;
@default(0) @display_name("Break On Win32 Stack Overflow Exceptions") @description("Code: 0xc00000fd")
win32_stack_overflow: bool;
@default(0) @display_name("Break On Win32 Unable To Locate DLL Exceptions") @description("Code: 0xc0000135")
win32_unable_to_locate_dll: bool;
@default(0) @display_name("Break On Win32 Ordinal Not Found Exceptions") @description("Code: 0xc0000138")
win32_ordinal_not_found: bool;
@default(0) @display_name("Break On Win32 Entry Point Not Found Exceptions") @description("Code: 0xc0000139")
win32_entry_point_not_found: bool;
@default(0) @display_name("Break On Win32 DLL Initialization Failed Exceptions") @description("Code: 0xc0000142")
win32_dll_initialization_failed: bool;
@default(0) @display_name("Break On Win32 Floating Point SSE Multiple Faults Exceptions") @description("Code: 0xc00002b4")
win32_floating_point_sse_multiple_faults: bool;
@default(0) @display_name("Break On Win32 Floating Point SSE Multiple Traps Exceptions") @description("Code: 0xc00002b5")
win32_floating_point_sse_multiple_traps: bool;
@default(1) @display_name("Break On Win32 Assertion Failed Exceptions") @description("Code: 0xc0000420")
win32_assertion_failed: bool;
@default(0) @display_name("Break On Win32 Module Not Found Exceptions") @description("Code: 0xc06d007e")
win32_module_not_found: bool;
@default(0) @display_name("Break On Win32 Procedure Not Found Exceptions") @description("Code: 0xc06d007f")
win32_procedure_not_found: bool;
@default(1) @display_name("Break On Win32 Sanitizer Error Detected Exceptions") @description("Code: 0xe073616e")
win32_sanitizer_error_detected: bool;
@default(0) @display_name("Break On Win32 Sanitizer Raw Access Violation Exceptions") @description("Code: 0xe0736171")
win32_sanitizer_raw_access_violation: bool;
@default(1) @display_name("Break On Win32 DirectX Debug Layer Exceptions") @description("Code: 0x0000087a")
win32_directx_debug_layer: bool;
}
```
}
+71 -51
View File
@@ -1213,19 +1213,65 @@ internal String8
rd_setting_from_name(String8 name)
{
String8 result = {0};
if(name.size != 0)
{
// rjf: find most-granular config scopes to begin looking for the setting
RD_Cfg *view_cfg = rd_cfg_from_id(rd_regs()->view);
RD_Cfg *start_cfg = &rd_nil_cfg;
if(start_cfg == &rd_nil_cfg) { start_cfg = rd_cfg_from_id(rd_regs()->panel); }
if(start_cfg == &rd_nil_cfg) { start_cfg = rd_cfg_from_id(rd_regs()->window); }
Temp scratch = scratch_begin(0, 0);
// rjf: scan upwards the config tree until we find the setting
RD_Cfg *setting = rd_cfg_child_from_string(view_cfg, name);
for(RD_Cfg *cfg = start_cfg; cfg != &rd_nil_cfg && setting == &rd_nil_cfg; cfg = cfg->parent)
// rjf: find most-granular config scopes to begin looking for the setting
typedef struct CfgSeedTask CfgSeedTask;
struct CfgSeedTask
{
setting = rd_cfg_child_from_string(cfg, name);
CfgSeedTask *next;
RD_Cfg *cfg;
B32 allow_bucket_chains;
};
RD_Cfg *view_cfg = rd_cfg_from_id(rd_regs()->view);
CfgSeedTask panel_task = {0, &rd_nil_cfg, 1};
if(panel_task.cfg == &rd_nil_cfg) { panel_task.cfg = rd_cfg_from_id(rd_regs()->panel); }
if(panel_task.cfg == &rd_nil_cfg) { panel_task.cfg = rd_cfg_from_id(rd_regs()->window); }
CfgSeedTask view_task = {&panel_task, view_cfg, 1};
CfgSeedTask *first_task = &view_task;
CfgSeedTask *last_task = &panel_task;
// rjf: for each task, look for the setting, follow parent chain upwards
RD_Cfg *setting = &rd_nil_cfg;
for(CfgSeedTask *t = first_task; t != 0; t = t->next)
{
for(RD_Cfg *cfg = t->cfg; cfg != &rd_nil_cfg; cfg = cfg->parent)
{
setting = rd_cfg_child_from_string(cfg, name);
if(setting != &rd_nil_cfg)
{
goto break_all;
}
if(cfg->parent == rd_state->root_cfg && t->allow_bucket_chains)
{
String8 next_bucket = {0};
B32 allow_bucket_chains = 0;
if(str8_match(cfg->string, str8_lit("user"), 0))
{
next_bucket = str8_lit("project");
}
else if(str8_match(cfg->string, str8_lit("project"), 0))
{
next_bucket = str8_lit("user");
}
else
{
allow_bucket_chains = 1;
next_bucket = str8_lit("user");
}
if(next_bucket.size != 0)
{
CfgSeedTask *task = push_array(scratch.arena, CfgSeedTask, 1);
SLLQueuePush(first_task, last_task, task);
task->cfg = rd_cfg_child_from_string(rd_state->root_cfg, next_bucket);
task->allow_bucket_chains = allow_bucket_chains;
}
}
}
}
break_all:;
// rjf: return resultant child string stored under this key
result = setting->first->string;
@@ -1233,12 +1279,21 @@ rd_setting_from_name(String8 name)
// rjf: no result -> look for default in schemas
if(result.size == 0)
{
result = rd_default_setting_from_names(view_cfg->string, name);
for(RD_Cfg *cfg = start_cfg; cfg != &rd_nil_cfg && result.size == 0; cfg = cfg->parent)
for(CfgSeedTask *t = first_task; t != 0; t = t->next)
{
result = rd_default_setting_from_names(cfg->string, name);
for(RD_Cfg *cfg = t->cfg; cfg != &rd_nil_cfg; cfg = cfg->parent)
{
result = rd_default_setting_from_names(cfg->string, name);
if(result.size != 0)
{
goto break_all2;
}
}
}
break_all2:;
}
scratch_end(scratch);
}
return result;
}
@@ -16030,50 +16085,15 @@ rd_frame(void)
//
U64 exception_code_filters[(CTRL_ExceptionCodeKind_COUNT+63)/64] = {0};
{
Temp scratch = scratch_begin(0, 0);
for(CTRL_ExceptionCodeKind k = (CTRL_ExceptionCodeKind)0; k < CTRL_ExceptionCodeKind_COUNT; k = (CTRL_ExceptionCodeKind)(k+1))
for EachNonZeroEnumVal(CTRL_ExceptionCodeKind, k)
{
if(ctrl_exception_code_kind_default_enable_table[k])
String8 name = ctrl_exception_code_kind_lowercase_code_string_table[k];
B32 setting = rd_setting_b32_from_name(name);
if(setting)
{
exception_code_filters[k/64] |= 1ull<<(k%64);
}
}
RD_CfgList exception_code_filters_roots = rd_cfg_top_level_list_from_string(scratch.arena, str8_lit("exception_code_filters"));
for(RD_CfgNode *n = exception_code_filters_roots.first; n != 0; n = n->next)
{
for(RD_Cfg *rule = n->v->first; rule != &rd_nil_cfg; rule = rule->next)
{
String8 name = rule->string;
String8 val_string = rule->first->string;
U64 val = 0;
if(try_u64_from_str8_c_rules(val_string, &val))
{
CTRL_ExceptionCodeKind kind = CTRL_ExceptionCodeKind_Null;
for(CTRL_ExceptionCodeKind k = (CTRL_ExceptionCodeKind)(CTRL_ExceptionCodeKind_Null+1);
k < CTRL_ExceptionCodeKind_COUNT;
k = (CTRL_ExceptionCodeKind)(k+1))
{
if(str8_match(name, ctrl_exception_code_kind_lowercase_code_string_table[k], 0))
{
kind = k;
break;
}
}
if(kind != CTRL_ExceptionCodeKind_Null)
{
if(val)
{
exception_code_filters[kind/64] |= (1ull<<(kind%64));
}
else
{
exception_code_filters[kind/64] &= ~(1ull<<(kind%64));
}
}
}
}
}
scratch_end(scratch);
}
////////////////////////////
+8 -4
View File
@@ -1677,10 +1677,14 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
// do a code-string of ".member_name"
String8 member_name = notable_expr->first->next->string;
String8 fancy_name = {0};
if(cell->eval.space.kind == RD_EvalSpaceKind_MetaCfg ||
cell->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity ||
cell->eval.space.kind == E_SpaceKind_File ||
cell->eval.space.kind == E_SpaceKind_FileSystem)
if(str8_match(member_name, str8_lit("$padding"), StringMatchFlag_RightSideSloppy))
{
fancy_name = str8_lit("Padding");
}
else if(cell->eval.space.kind == RD_EvalSpaceKind_MetaCfg ||
cell->eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity ||
cell->eval.space.kind == E_SpaceKind_File ||
cell->eval.space.kind == E_SpaceKind_FileSystem)
{
fancy_name = rd_display_from_code_name(member_name);
}