summaryrefslogtreecommitdiff
path: root/python/architecture.py
diff options
context:
space:
mode:
authorJordan <jordan@psifertex.com>2018-10-31 17:18:45 -0400
committerGitHub <noreply@github.com>2018-10-31 17:18:45 -0400
commit2d63f0bb95c18b4379d6bf26810ccc8f8a19f64c (patch)
tree5cc2d1dc3d974a35a9382523475d3be52d0f3242 /python/architecture.py
parentaeaf94da627c819eece50fc2773cdbf3bb888ec0 (diff)
parent3c831197b940d310665928006906951c735053c8 (diff)
Merge pull request #1188 from shane-runsafe/assemble_fixes
Return assemble error string as part of the ValueError exception
Diffstat (limited to 'python/architecture.py')
-rw-r--r--python/architecture.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/architecture.py b/python/architecture.py
index aee7c301..5f280a98 100644
--- a/python/architecture.py
+++ b/python/architecture.py
@@ -1784,12 +1784,12 @@ class Architecture(with_metaclass(_ArchitectureMetaClass, object)):
:param str code: string representation of the instructions to be assembled
:param int addr: virtual address that the instructions will be loaded at
- :return: the bytes for the assembled instructions or error string
- :rtype: (a tuple of instructions and empty string) or (or None and error string)
+ :return: the bytes for the assembled instructions
+ :rtype: Python3 - a 'bytes' object; Python2 - a 'bytes' object
:Example:
>>> arch.assemble("je 10")
- ('\\x0f\\x84\\x04\\x00\\x00\\x00', '')
+ '\\x0f\\x84\\x04\\x00\\x00\\x00'
>>>
"""
return self.perform_assemble(code, addr)
@@ -2416,17 +2416,17 @@ class CoreArchitecture(Architecture):
:param str code: string representation of the instructions to be assembled
:param int addr: virtual address that the instructions will be loaded at
:return: the bytes for the assembled instructions
- :rtype: Python3 - a 'bytes' object; Python2 - a 'str'
+ :rtype: Python3 - a 'bytes' object; Python2 - a 'bytes' object
:Example:
>>> arch.assemble("je 10")
- ('\\x0f\\x84\\x04\\x00\\x00\\x00', '')
+ '\\x0f\\x84\\x04\\x00\\x00\\x00'
>>>
"""
result = databuffer.DataBuffer()
errors = ctypes.c_char_p()
if not core.BNAssemble(self.handle, code, addr, result.handle, errors):
- raise ValueError("Could not assemble")
+ raise ValueError("Could not assemble: %s" % errors.value)
if isinstance(str(result), bytes):
return str(result)
else: