Ignore invalid instructions

This could be a bad idea, but
it's unclear how to properly
handle these cases.

Resolves #55
This commit is contained in:
Luke Street 2024-06-10 00:40:37 -06:00
parent b44aa78c49
commit 3289b2a3aa
2 changed files with 16 additions and 8 deletions

View File

@ -266,8 +266,13 @@ impl FunctionSlices {
} }
} }
StepResult::Illegal => { StepResult::Illegal => {
log::debug!("Illegal instruction @ {:#010X}", ins_addr); if ins.code == 0 {
log::debug!("Hit zeroed padding @ {:#010X}", ins_addr);
Ok(ExecCbResult::End(false)) Ok(ExecCbResult::End(false))
} else {
log::debug!("Illegal instruction @ {:#010X}", ins_addr);
Ok(ExecCbResult::Continue)
}
} }
StepResult::Jump(target) => match target { StepResult::Jump(target) => match target {
BranchTarget::Unknown BranchTarget::Unknown

View File

@ -348,12 +348,15 @@ impl Tracker {
} }
Ok(ExecCbResult::Continue) Ok(ExecCbResult::Continue)
} }
StepResult::Illegal => bail!( StepResult::Illegal => {
log::debug!(
"Illegal instruction hit @ {:#010X} (function {:#010X}-{:#010X})", "Illegal instruction hit @ {:#010X} (function {:#010X}-{:#010X})",
ins_addr, ins_addr,
function_start, function_start,
function_end function_end
), );
Ok(ExecCbResult::Continue)
}
StepResult::Jump(target) => match target { StepResult::Jump(target) => match target {
BranchTarget::Unknown BranchTarget::Unknown
| BranchTarget::Return | BranchTarget::Return