[Lldb-commits] [lldb] r107518 - /lldb/trunk/source/Expression/IRToDWARF.cpp

Sean Callanan scallanan at apple.com
Fri Jul 2 14:28:36 PDT 2010


Author: spyffe
Date: Fri Jul  2 16:28:35 2010
New Revision: 107518

URL: http://llvm.org/viewvc/llvm-project?rev=107518&view=rev
Log:
Small fixes to the DWARF relocator.

Modified:
    lldb/trunk/source/Expression/IRToDWARF.cpp

Modified: lldb/trunk/source/Expression/IRToDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRToDWARF.cpp?rev=107518&r1=107517&r2=107518&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRToDWARF.cpp (original)
+++ lldb/trunk/source/Expression/IRToDWARF.cpp Fri Jul  2 16:28:35 2010
@@ -97,9 +97,13 @@
             int16_t relative = (int16_t)target_off - (int16_t)off;
             
             swapper.Clear();
-            swapper << target_off;
+            swapper << relative;
             
-            memcpy(temporary_buffer + off, swapper.GetData(), sizeof(uint16_t));
+            // off is intended to be the offset of the branch opcode (which is 
+            // what the relative location is added to) so 
+            // (temporary_buffer + off + 1) skips the opcode and writes to the
+            // relative location
+            memcpy(temporary_buffer + off + 1, swapper.GetData(), sizeof(uint16_t));
         }
         
         strm.Clear();





More information about the lldb-commits mailing list