summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2020-07-28 23:11:42 +0800
committerXusheng <xusheng@vector35.com>2020-07-28 23:11:42 +0800
commit5369369447df3b182e51d9305e1ed49659b63b10 (patch)
tree583d5c92f0974942d4d986b63cdaf91adaf58a0b /python
parent630824de49fcde2f61701ac2019834bda079a341 (diff)
add __repr__ for LowLevelILFunction
Diffstat (limited to 'python')
-rw-r--r--python/lowlevelil.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index 59521a67..9435f07b 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -1305,11 +1305,14 @@ class LowLevelILFunction(object):
core.BNFreeLowLevelILFunction(self.handle)
def __repr__(self):
- arch = self.source_function.arch
- if arch:
+ source_function = getattr(self, "source_function", None)
+ arch = getattr(source_function, "arch", None)
+ if arch and source_function:
return "<llil func: %s@%#x>" % (arch.name, self.source_function.start)
- else:
+ elif source_function:
return "<llil func: %#x>" % self.source_function.start
+ else:
+ return "<llil func: anonymous>"
def __len__(self):
return int(core.BNGetLowLevelILInstructionCount(self.handle))