diff options
| author | Brandon Miller <brandon@vector35.com> | 2025-10-21 16:03:13 -0400 |
|---|---|---|
| committer | Brandon Miller <brandon@vector35.com> | 2025-10-22 08:11:40 -0400 |
| commit | 3e63b6e83ad95663e478a63f39b271d308db6f89 (patch) | |
| tree | 2dd74890b15451900f0872144672094ad965b2c5 | |
| parent | f2c843dfc8697e492d6e2d178dce0d1541004dd6 (diff) | |
Add setter for BB analysis context max_size_reached
Add setter for Python and rust BasicBlockAnalysisContext.max_size_reached
| -rw-r--r-- | python/architecture.py | 14 | ||||
| -rw-r--r-- | rust/src/architecture.rs | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/python/architecture.py b/python/architecture.py index 0b149057..278b3317 100644 --- a/python/architecture.py +++ b/python/architecture.py @@ -86,9 +86,9 @@ class BasicBlockAnalysisContext: _translate_tail_calls: bool _disallow_branch_to_string: bool _max_function_size: int - _max_size_reached: bool # In/Out + _max_size_reached: bool _contextual_returns: Dict["function.ArchAndAddr", bool] # Out @@ -231,6 +231,17 @@ class BasicBlockAnalysisContext: return self._max_size_reached + @max_size_reached.setter + def max_size_reached(self, value: bool) -> None: + """Set boolean that indicates if the maximum function size has been reached. + + :param bool value: The new value for max_size_reached + """ + if not isinstance(value, bool): + raise TypeError("value must be a boolean") + + self._max_size_reached = value + @property def contextual_returns(self) -> Dict["function.ArchAndAddr", bool]: """Get the mapping of contextual function return locations to their values.""" @@ -387,6 +398,7 @@ class BasicBlockAnalysisContext: halted_addresses[i].address = loc.addr core.BNAnalyzeBasicBlocksContextSetHaltedDisassemblyAddresses(self._handle, halted_addresses, total) + self._handle.maxSizeReached = ctypes.c_bool(self._max_size_reached) if self._contextual_returns_dirty: total = len(self._contextual_returns) values = (ctypes.c_bool * total)() diff --git a/rust/src/architecture.rs b/rust/src/architecture.rs index c7fbe5f1..3ea21514 100644 --- a/rust/src/architecture.rs +++ b/rust/src/architecture.rs @@ -1966,9 +1966,9 @@ pub struct BasicBlockAnalysisContext { pub translate_tail_calls: bool, pub disallow_branch_to_string: bool, pub max_function_size: u64, - pub max_size_reached: bool, // In/Out + pub max_size_reached: bool, contextual_returns: HashMap<ArchAndAddr, bool>, // Out @@ -2179,6 +2179,10 @@ impl BasicBlockAnalysisContext { } } + unsafe { + (*self.handle).maxSizeReached = self.max_size_reached; + } + if self.contextual_returns_dirty { let total = self.contextual_returns.len(); let mut locations: Vec<BNArchitectureAndAddress> = Vec::with_capacity(total); |
