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

x29 and x30 registers not displayed because they are named fp and lr #17

Closed shangoue closed 8 months ago

shangoue commented 12 months ago

Hi, here is a small patch proposal to fix the display of x29 and x39 in llef:

diff --git a/arch/aarch64.py b/arch/aarch64.py
index bc6d220..e629fbf 100644
--- a/arch/aarch64.py
+++ b/arch/aarch64.py
@@ -40,8 +40,8 @@ class Aarch64(BaseArch):
         "x26",
         "x27",
         "x28",
-        "x29",
-        "x30",
+        "fp",
+        "lr",
         "sp",
         "pc",
     ]

Here is my LLDM version:

lldb-1500.0.22.8
Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)

Thanks for this great project!

stephen-f0 commented 8 months ago

Many thanks for your bug report.

Under testing I've noticed that depending on the target system / possibly lldb version both the aliases lr/fp and x29/x30 can be returned. For example qemu aarch64 targets only return x29/x30.

I've therefore just appended lr and fp to the list of registers we pull out which should be a safe way to handle both scenarios.