foundryzero / llef

LLEF is a plugin for LLDB to make it more useful for RE and VR
MIT License
336 stars 18 forks source link

Unknown Architecture: x86_64h #46

Open chennbnbnb opened 2 months ago

chennbnbnb commented 2 months ago

Hello, I have installed lldb15,

lldb-1500.0.200.58
Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)

and I get the following error when using llef

Architecture set to: x86_64h-apple-macosx-.
(lldb) si
(lldb) [+] Unknown Architecture: x86_64h
Traceback (most recent call last):
  File "/Users/chenhaohao/Downloads/chrome/llef-main/handlers/stop_hook.py", line 37, in handle_stop
    self.context_handler.display_context(exe_ctx, True)
  File "/Users/chenhaohao/Downloads/chrome/llef-main/common/context_handler.py", line 449, in display_context
    self.refresh(exe_ctx)
  File "/Users/chenhaohao/Downloads/chrome/llef-main/common/context_handler.py", line 434, in refresh
    self.arch = get_arch(self.target)
  File "/Users/chenhaohao/Downloads/chrome/llef-main/arch/__init__.py", line 33, in get_arch
    return get_arch_from_str(arch)
  File "/Users/chenhaohao/Downloads/chrome/llef-main/arch/__init__.py", line 42, in get_arch_from_str
    raise TypeError(f"Unknown target architecture: {arch}")
TypeError: Unknown target architecture: x86_64h
Process 35072 stopped
* thread #1, name = 'CrRendererMain', queue = 'com.apple.main-thread', stop reason = instruction step into
    frame #0: 0x00007ff80df846cd libsystem_kernel.dylib`mach_msg2_internal + 78
Target 0: (ME Helper (Renderer)) stopped.

How to solve this problem?

joseph-f0 commented 2 months ago

Hi, thanks for raising the issue.

This is because LLEF doesn't currently have support for the x86_64h target architecture.

It looks like the x86_64h ISA is the same as x86_64, so adding support might be as simple as adding an alias in the supported architectures list.

This can be done by adding the following on line 26 of arch/__init__.py:

supported_arch = {
   ...
   "x86_64h": X86_64,
   ...
}

I've included a git patch that contains these changes.

patch.diff.txt

I haven't been able to test this as I don't have a target device to hand, so please let me know how you get on!