Skip to content

Commit

Permalink
Merge pull request #401 from philipc/issue-397
Browse files Browse the repository at this point in the history
cfi: use code_alignment_factor when evaluating AdvanceLoc
  • Loading branch information
fitzgen authored Mar 7, 2019
2 parents f30aeaa + 23978e5 commit 5763791
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/read/cfi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,8 @@ impl<'ctx, R: Reader> UnwindTable<'ctx, R> {
return Ok(true);
}
AdvanceLoc { delta } => {
self.next_start_address = self.ctx.start_address() + u64::from(delta);
let delta = u64::from(delta) * self.code_alignment_factor;
self.next_start_address = self.ctx.start_address() + delta;
self.ctx.row_mut().end_address = self.next_start_address;
return Ok(true);
}
Expand Down Expand Up @@ -4694,8 +4695,8 @@ mod tests {
let mut ctx = UnwindContext::new();
ctx.row_mut().start_address = 3;
let mut expected = ctx.clone();
expected.row_mut().end_address = 4;
let instructions = [(Ok(true), CallFrameInstruction::AdvanceLoc { delta: 1 })];
expected.row_mut().end_address = 3 + 2 * cie.code_alignment_factor;
let instructions = [(Ok(true), CallFrameInstruction::AdvanceLoc { delta: 2 })];
assert_eval(ctx, expected, cie, None, instructions);
}

Expand Down

0 comments on commit 5763791

Please sign in to comment.