dwarf: do not crash on unsupported codes; text: do not crash on arena releasing w/ zero hash (#766, #771?, #761)

This commit is contained in:
Ryan Fleury
2026-04-30 17:51:11 -07:00
parent c83c1f3cfd
commit 0e2b37ba32
4 changed files with 47 additions and 33 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ commands =
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg meta telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg meta telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "build radbin && pushd build && del simple.rdi && del simple.dump && radbin --rdi simple && radbin --dump simple.rdi --out:simple.dump", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, .f1 = { .win = "build radbin && pushd build && del raddbg.elf.rdi && del raddbg.elf.dump && radbin --rdi ./raddbg --out:raddbg.elf.rdi && radbin --dump raddbg.elf.rdi --out:raddbg.elf.dump", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [raddbg wsl] //- rjf: [raddbg wsl]
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+40 -26
View File
@@ -341,7 +341,8 @@ internal U64
dw_pick_default_lower_bound(DW_Language lang) dw_pick_default_lower_bound(DW_Language lang)
{ {
U64 lower_bound = max_U64; U64 lower_bound = max_U64;
switch (lang) { switch(lang)
{
case DW_Language_Null: break; case DW_Language_Null: break;
case DW_Language_C89: case DW_Language_C89:
case DW_Language_C: case DW_Language_C:
@@ -366,8 +367,9 @@ dw_pick_default_lower_bound(DW_Language lang)
case DW_Language_Dylan: case DW_Language_Dylan:
case DW_Language_RenderScript: case DW_Language_RenderScript:
case DW_Language_BLISS: case DW_Language_BLISS:
{
lower_bound = 0; lower_bound = 0;
break; }break;
case DW_Language_Ada83: case DW_Language_Ada83:
case DW_Language_Cobol74: case DW_Language_Cobol74:
case DW_Language_Cobol85: case DW_Language_Cobol85:
@@ -382,10 +384,10 @@ dw_pick_default_lower_bound(DW_Language lang)
case DW_Language_Julia: case DW_Language_Julia:
case DW_Language_Fortran03: case DW_Language_Fortran03:
case DW_Language_Fortran08: case DW_Language_Fortran08:
{
lower_bound = 1; lower_bound = 1;
default: }break;
NotImplemented; default:{}break;
break;
} }
return lower_bound; return lower_bound;
} }
@@ -393,61 +395,69 @@ dw_pick_default_lower_bound(DW_Language lang)
internal U64 internal U64
dw_operand_count_from_expr_op(DW_ExprOp op) dw_operand_count_from_expr_op(DW_ExprOp op)
{ {
switch (op) { U64 result = 0;
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, ...) case _ID: return _OPER_COUNT; switch(op)
{
default:{}break;
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, ...) case _ID:{result = _OPER_COUNT;}break;
DW_Expr_V3_XList DW_Expr_V3_XList
DW_Expr_V4_XList DW_Expr_V4_XList
DW_Expr_V5_XList DW_Expr_V5_XList
DW_Expr_GNU_XList DW_Expr_GNU_XList
#undef X #undef X
default: { NotImplemented; } break;
} }
return 0; return result;
} }
internal U64 internal U64
dw_pop_count_from_expr_op(DW_ExprOp op) dw_pop_count_from_expr_op(DW_ExprOp op)
{ {
switch (op) { U64 result = 0;
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, ...) case _ID: return _POP_COUNT; switch(op)
{
default:{}break;
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, ...) case _ID:{result = _POP_COUNT;}break;
DW_Expr_V3_XList DW_Expr_V3_XList
DW_Expr_V4_XList DW_Expr_V4_XList
DW_Expr_V5_XList DW_Expr_V5_XList
DW_Expr_GNU_XList DW_Expr_GNU_XList
#undef X #undef X
default: { NotImplemented; } break;
} }
return 0; return result;
} }
internal U64 internal U64
dw_push_count_from_expr_op(DW_ExprOp op) dw_push_count_from_expr_op(DW_ExprOp op)
{ {
U64 result = 0;
switch (op) { switch (op) {
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, ...) case _ID: return _PUSH_COUNT; default:{}break;
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, ...) case _ID:{result = _PUSH_COUNT;}break;
DW_Expr_V3_XList DW_Expr_V3_XList
DW_Expr_V4_XList DW_Expr_V4_XList
DW_Expr_V5_XList DW_Expr_V5_XList
DW_Expr_GNU_XList DW_Expr_GNU_XList
#undef X #undef X
default: { NotImplemented; } break;
} }
return 0; return result;
} }
internal DW_ExprOperandType * internal DW_ExprOperandType *
dw_operand_types_from_expr_opcode(DW_ExprOp op) dw_operand_types_from_expr_opcode(DW_ExprOp op)
{ {
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, _OPER_TYPE0, _OPER_TYPE1) case _ID: { local_persist DW_ExprOperandType t[] = { DW_ExprOperandType_##_OPER_TYPE0, DW_ExprOperandType_##_OPER_TYPE1 }; return t; } local_persist DW_ExprOperandType nil_t[] = {DW_ExprOperandType_Null};
switch (op) { DW_ExprOperandType *result = nil_t;
switch(op)
{
default:{}break;
#define X(_N, _ID, _OPER_COUNT, _POP_COUNT, _PUSH_COUNT, _OPER_TYPE0, _OPER_TYPE1) case _ID: { local_persist DW_ExprOperandType t[] = { DW_ExprOperandType_##_OPER_TYPE0, DW_ExprOperandType_##_OPER_TYPE1 }; result = t; }break;
DW_Expr_V3_XList DW_Expr_V3_XList
DW_Expr_V4_XList DW_Expr_V4_XList
DW_Expr_V5_XList DW_Expr_V5_XList
DW_Expr_GNU_XList DW_Expr_GNU_XList
#undef X #undef X
default: { NotImplemented; } break;
} }
return 0; return result;
} }
internal U64 internal U64
@@ -466,7 +476,9 @@ internal B32
dw_is_cfa_expr_opcode_invalid(DW_ExprOp opcode) dw_is_cfa_expr_opcode_invalid(DW_ExprOp opcode)
{ {
B32 is_invalid = 0; B32 is_invalid = 0;
switch (opcode) { switch(opcode)
{
default:{}break;
case DW_ExprOp_Addrx: case DW_ExprOp_Addrx:
case DW_ExprOp_Call2: case DW_ExprOp_Call2:
case DW_ExprOp_Call4: case DW_ExprOp_Call4:
@@ -478,10 +490,10 @@ dw_is_cfa_expr_opcode_invalid(DW_ExprOp opcode)
case DW_ExprOp_RegvalType: case DW_ExprOp_RegvalType:
case DW_ExprOp_Reinterpret: case DW_ExprOp_Reinterpret:
case DW_ExprOp_PushObjectAddress: case DW_ExprOp_PushObjectAddress:
case DW_ExprOp_CallFrameCfa: { case DW_ExprOp_CallFrameCfa:
{
is_invalid = 1; is_invalid = 1;
}break; }break;
default: break;
} }
return is_invalid; return is_invalid;
} }
@@ -490,15 +502,17 @@ internal B32
dw_is_new_row_cfa_opcode(DW_CFA_Opcode opcode) dw_is_new_row_cfa_opcode(DW_CFA_Opcode opcode)
{ {
B32 is_new_row_op = 0; B32 is_new_row_op = 0;
switch (opcode) { switch(opcode)
{
default:{}break;
case DW_CFA_SetLoc: case DW_CFA_SetLoc:
case DW_CFA_AdvanceLoc: case DW_CFA_AdvanceLoc:
case DW_CFA_AdvanceLoc1: case DW_CFA_AdvanceLoc1:
case DW_CFA_AdvanceLoc2: case DW_CFA_AdvanceLoc2:
case DW_CFA_AdvanceLoc4: { case DW_CFA_AdvanceLoc4:
{
is_new_row_op = 1; is_new_row_op = 1;
}break; }break;
default: break;
} }
return is_new_row_op; return is_new_row_op;
} }
+1 -1
View File
@@ -763,7 +763,7 @@ rb_thread_entry_point(void *p)
convert_params.deterministic = cmd_line_has_flag(cmdline, str8_lit("deterministic")); convert_params.deterministic = cmd_line_has_flag(cmdline, str8_lit("deterministic"));
convert_params.is_parse_relaxed = 1; // TODO: switch convert_params.is_parse_relaxed = 1; // TODO: switch
} }
ProfScope("convert") dwarf_bake_params = d2r_convert(arena, &convert_params); // ProfScope("convert") dwarf_bake_params = d2r_convert(arena, &convert_params);
// rjf: convert [2] // rjf: convert [2]
D2R2_ConvertParams convert_params_2 = {0}; D2R2_ConvertParams convert_params_2 = {0};
+1 -1
View File
@@ -2923,7 +2923,7 @@ txt_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *gen_ou
} }
//- rjf: cancel -> release //- rjf: cancel -> release
if(lane_idx() == 0 && ins_atomic_u32_eval(cancel_signal)) if(lane_idx() == 0 && ins_atomic_u32_eval(cancel_signal) && shared->arena != 0)
{ {
arena_release(shared->arena); arena_release(shared->arena);
shared->arena = 0; shared->arena = 0;