Skip to content

Commit

Permalink
Merge branch 'split-after-padding' into 'main'
Browse files Browse the repository at this point in the history
split candidate blocks when we go from padding to non-padding.

See merge request rewriting/ddisasm!1225
  • Loading branch information
aeflores committed Oct 22, 2024
2 parents a1b0312 + f021474 commit b134d8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fixed bug in pointers to string data blocks.
- Restrict padding blocks so they do not share instructions with code blocks.
- Start a new block if we transition from padding to not padding
or from not padding to padding.
- Change the type of several heuristics from "simple" to "proportional"
- Additional heuristic: Simple string literals in literal pools
- Additional heuristic: Function beginning pattern with push/adjust-sp as plausible instruction sequence
Expand Down
9 changes: 8 additions & 1 deletion src/datalog/code_inference.dl
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,9 @@ block_limit(Inst):-
arch.instruction_at(EA+Size,Inst).

/**
We want to split blocks that go from non-padding to padding.
We want to split blocks that go from non-padding to padding
or from padding to non-padding.

However, this cannot be a regular block_limit because several
instructions could fallthrough into another one.
We need to consider the source address too.
Expand All @@ -396,6 +398,11 @@ transition_block_limit(EA,Next):-
next(EA,Next),
!is_padding(EA).

transition_block_limit(EA,Next):-
is_padding(EA),
next(EA,Next),
!is_padding(Next).

// The targets are computed incrementally now as we traverse the code
// likely_ea and possible_target_from are mutually recursive

Expand Down

0 comments on commit b134d8d

Please sign in to comment.