[Lldb-commits] [PATCH] D15457: Remove hardcoded registers from Hexagon ABI

Ted Woodward via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 11 10:23:07 PST 2015


ted created this revision.
ted added a reviewer: clayborg.
ted added a subscriber: lldb-commits.

The Hexagon ABI plugin uses hardcoded registers when setting up function calls. This is OK for the Hexagon simulator, but the register numbers are different on the gdbserver running on hardware. Change the hardcoded registers to LLDB generic registers.

http://reviews.llvm.org/D15457

Files:
  source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp

Index: source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
===================================================================
--- source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
+++ source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
@@ -226,7 +226,7 @@
 //  . handle 64bit values and their register / stack requirements
 
 */
-#define HEX_ABI_DEBUG 1
+#define HEX_ABI_DEBUG 0
 bool
 ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, 
                                       lldb::addr_t  sp  , 
@@ -323,10 +323,12 @@
     }
 
     // update registers with current function call state
-    reg_ctx->WriteRegisterFromUnsigned ( 41, pc );
-    reg_ctx->WriteRegisterFromUnsigned ( 31, ra );
-    reg_ctx->WriteRegisterFromUnsigned ( 29, sp );
-//  reg_ctx->WriteRegisterFromUnsigned ( FP ??? );
+    uint32_t pc_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
+    reg_ctx->WriteRegisterFromUnsigned(pc_reg, pc);
+    uint32_t ra_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
+    reg_ctx->WriteRegisterFromUnsigned(ra_reg, ra);
+    uint32_t sp_reg = reg_ctx->ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
+    reg_ctx->WriteRegisterFromUnsigned(sp_reg, sp);
 
 #if HEX_ABI_DEBUG
     // quick and dirty stack dumper for debugging


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15457.42540.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151211/78e95a5b/attachment.bin>


More information about the lldb-commits mailing list