summaryrefslogtreecommitdiff
path: root/python/variable.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2022-07-07 21:03:29 -0400
committerRusty Wagner <rusty.wagner@gmail.com>2022-08-10 15:17:53 -0400
commit390d5d27d4de6b7c9cb06b957a483bb2ab69f241 (patch)
tree556133db637166968a77d68daf7ff2160df79b40 /python/variable.py
parent4037000b6cb8a184ad098d0eff397518d7fe55b9 (diff)
Merge variables API/UI, variable liveness API for determining soundness of variable merges
Diffstat (limited to 'python/variable.py')
-rw-r--r--python/variable.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/python/variable.py b/python/variable.py
index 07b8863c..839e87ce 100644
--- a/python/variable.py
+++ b/python/variable.py
@@ -663,7 +663,7 @@ class Variable(CoreVariable):
if self.type is not None:
return f"<var {self.type.get_string_before_name()} {self.name}{self.type.get_string_after_name()}>"
else:
- return repr(super())
+ return f"<var {self.name}>"
def __str__(self):
return self.name
@@ -712,7 +712,7 @@ class Variable(CoreVariable):
@property
def name(self) -> str:
"""Name of the variable, Settings thisslow because it ensures that analysis has been updated. """
- return core.BNGetRealVariableName(self._function.handle, self._function.arch.handle, self.to_BNVariable())
+ return core.BNGetVariableNameOrDefault(self._function.handle, self.to_BNVariable())
@name.setter
def name(self, name: Optional[str]) -> None:
@@ -720,6 +720,11 @@ class Variable(CoreVariable):
self._function.view.update_analysis_and_wait()
@property
+ def last_seen_name(self) -> str:
+ """Name of the variable, or the name most recently assigned if the variable has since been removed (read-only). """
+ return core.BNGetLastSeenVariableNameOrDefault(self._function.handle, self.to_BNVariable())
+
+ @property
def type(self) -> Optional['binaryninja.types.Type']:
var_type_conf = core.BNGetVariableType(self._function.handle, self.to_BNVariable())
if var_type_conf.type: