mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
handle CFI programs without meaningful instructions
This commit is contained in:
committed by
Ryan Fleury
parent
7616767ed7
commit
3f70cd6d05
@@ -66,6 +66,7 @@ internal B32
|
|||||||
dw_cfi_next_row(Arena *arena, DW_CFI_Unwind *uw)
|
dw_cfi_next_row(Arena *arena, DW_CFI_Unwind *uw)
|
||||||
{
|
{
|
||||||
B32 is_row_valid = 0;
|
B32 is_row_valid = 0;
|
||||||
|
DW_CFA_InstNode *row_inst = uw->curr_inst;
|
||||||
|
|
||||||
// skip leading nops
|
// skip leading nops
|
||||||
while (uw->curr_inst) {
|
while (uw->curr_inst) {
|
||||||
@@ -187,14 +188,13 @@ dw_cfi_next_row(Arena *arena, DW_CFI_Unwind *uw)
|
|||||||
default: { NotImplemented; } break; // TODO: report error: unknown CFA opcode
|
default: { NotImplemented; } break; // TODO: report error: unknown CFA opcode
|
||||||
}
|
}
|
||||||
|
|
||||||
is_row_valid = 1;
|
|
||||||
|
|
||||||
uw->curr_inst = uw->curr_inst->next;
|
uw->curr_inst = uw->curr_inst->next;
|
||||||
if (uw->curr_inst) {
|
if (uw->curr_inst) {
|
||||||
if (dw_is_new_row_cfa_opcode(uw->curr_inst->v.opcode)) { break; }
|
if (dw_is_new_row_cfa_opcode(uw->curr_inst->v.opcode)) { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_row_valid = row_inst != 0;
|
||||||
exit:;
|
exit:;
|
||||||
return is_row_valid;
|
return is_row_valid;
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ dw_cfi_row_from_pc(Arena *arena, Arch arch, DW_CIE *cie, DW_FDE *fde, DW_DecodeP
|
|||||||
|
|
||||||
// handle last row
|
// handle last row
|
||||||
if (!is_row_found) {
|
if (!is_row_found) {
|
||||||
if (prev_pc <= pc && pc < uw->pc && contains_1u64(fde->pc_range, pc)) {
|
if (contains_1u64(fde->pc_range, pc)) {
|
||||||
row = uw->row;
|
row = uw->row;
|
||||||
is_row_found = 1;
|
is_row_found = 1;
|
||||||
}
|
}
|
||||||
@@ -272,10 +272,7 @@ dw_cfi_apply_register_rules(Arch arch,
|
|||||||
for EachIndex(reg_idx, reg_count) {
|
for EachIndex(reg_idx, reg_count) {
|
||||||
DW_CFI_Register *reg = &row->regs[reg_idx];
|
DW_CFI_Register *reg = &row->regs[reg_idx];
|
||||||
switch (reg->rule) {
|
switch (reg->rule) {
|
||||||
case DW_CFI_RegisterRule_Undefined: {
|
case DW_CFI_RegisterRule_Undefined: {} break;
|
||||||
// TODO: ???
|
|
||||||
Assert(!"undefined");
|
|
||||||
} break;
|
|
||||||
case DW_CFI_RegisterRule_SameValue: {} break;
|
case DW_CFI_RegisterRule_SameValue: {} break;
|
||||||
case DW_CFI_RegisterRule_Offset: {
|
case DW_CFI_RegisterRule_Offset: {
|
||||||
// read register value from memory
|
// read register value from memory
|
||||||
|
|||||||
Reference in New Issue
Block a user