Skip to content

Commit

Permalink
speed up ihex ppc
Browse files Browse the repository at this point in the history
  • Loading branch information
DennyDai committed Mar 4, 2024
1 parent 782b476 commit d9c512a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/patcherex2/components/binary_analyzers/angr.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, binary_path: str, **kwargs) -> None:
self.binary_path = binary_path
# self.use_pickle = kwargs.pop("use_pickle", False) # TODO: implement this
self.angr_kwargs = kwargs.pop("angr_kwargs", {})
self.angr_cfg_kwargs = kwargs.pop("angr_cfg_kwargs", {})
self._p = None
self._cfg = None
self._load_base = None
Expand Down Expand Up @@ -48,9 +49,9 @@ def p(self) -> angr.Project:
def cfg(self) -> angr.analyses.cfg.cfg_fast.CFGFast:
if self._cfg is None:
logger.info("Generating CFG with angr")
self._cfg = self.p.analyses.CFGFast(
normalize=True, data_references=True, force_complete_scan=False
)
if "normalize" not in self.angr_cfg_kwargs:
self.angr_cfg_kwargs["normalize"] = True
self._cfg = self.p.analyses.CFGFast(**self.angr_cfg_kwargs)
logger.info("Generated CFG with angr")
return self._cfg

Expand Down
6 changes: 6 additions & 0 deletions src/patcherex2/targets/ihex_ppc_bare.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def get_binary_analyzer(self, binary_analyzer):
"auto_load_libs": False,
"load_debug_info": True,
},
angr_cfg_kwargs={
"normalize": True,
"data_references": True,
"force_smart_scan": False,
"force_complete_scan": False,
},
)
raise NotImplementedError()

Expand Down

0 comments on commit d9c512a

Please sign in to comment.