unicorn-engine / unicorn

Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, TriCore, X86)
http://www.unicorn-engine.org
GNU General Public License v2.0
7.47k stars 1.33k forks source link

Misleading Error Message when Architecture is Unavailable #531

Closed zachriggle closed 8 years ago

zachriggle commented 8 years ago

If you build with UNICORN_ARCHS='x86' and then attempt to create an ARM Uc object, the error message you get is: exception str() failed.

>>> pwndbg.emu.emulator.Emulator()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/pwndbg/pwndbg/emu/emulator.py", line 105, in __init__
    self.uc = U.Uc(arch_to_UC[self.arch], self.mode)
  File "/usr/local/lib/python3.5/dist-packages/unicorn/unicorn.py", line 215, in __init__
    raise UcError(status)
unicorn.unicorn.UcError: <exception str() failed>
aquynh commented 8 years ago

something is wrong in your code? here is what i get:

$ UNICORN_ARCHS="x86" ./make.sh
....

$ sudo UNICORN_ARCHS="x86" ./make.sh install
...

$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from unicorn import *
>>> uc = Uc(UC_ARCH_ARM, UC_MODE_ARM)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/unicorn/unicorn.py", line 215, in __init__
    raise UcError(status)
unicorn.unicorn.UcError: Invalid/unsupported architecture (UC_ERR_ARCH)
aquynh commented 8 years ago

close, thanks!