diff options
| author | Shane Fry <shane@runsafesecurity.com> | 2018-10-25 09:16:19 -0500 |
|---|---|---|
| committer | Shane Fry <shane@runsafesecurity.com> | 2018-10-25 09:16:19 -0500 |
| commit | 3c831197b940d310665928006906951c735053c8 (patch) | |
| tree | cd81cc9b51339cc1e69149082b4b03d7972a2aed /python/architecture.py | |
| parent | ec7d4ac5ecfb59ce98ac64f2ed889b73655df746 (diff) | |
Return assemble error string as part of the ValueError exception string. Cleaned up documentation for assemble's return type
Diffstat (limited to 'python/architecture.py')
| -rw-r--r-- | python/architecture.py | 12 |
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: |
