[Lldb-commits] [lldb] r124460 - /lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp

Johnny Chen johnny.chen at apple.com
Thu Jan 27 16:32:27 PST 2011


Author: johnny
Date: Thu Jan 27 18:32:27 2011
New Revision: 124460

URL: http://llvm.org/viewvc/llvm-project?rev=124460&view=rev
Log:
Should provide more useful context info for the emulate_ldr_rd_pc_rel() impl.
The context being that it's a PC relative load.

Modified:
    lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp?rev=124460&r1=124459&r2=124460&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/EmulateInstructionARM.cpp Thu Jan 27 18:32:27 2011
@@ -288,6 +288,12 @@
         const uint32_t pc = emulator->ReadRegisterUnsigned(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, 0, &success);
         if (!success)
             return false;
+
+        // PC relative immediate load context
+        EmulateInstruction::Context context = {EmulateInstruction::eContextRegisterPlusOffset,
+                                               eRegisterKindGeneric,
+                                               LLDB_REGNUM_GENERIC_PC,
+                                               0};
         uint32_t Rd; // the destination register
         uint32_t imm32; // immediate offset from the PC
         addr_t addr;    // the PC relative address
@@ -297,21 +303,14 @@
             Rd = Bits32(opcode, 10, 8);
             imm32 = Bits32(opcode, 7, 0) << 2; // imm32 = ZeroExtend(imm8:'00', 32);
             addr = pc + 4 + imm32;
+            context.arg2 = 4 + imm32;
             break;
         default:
             return false;
         }
-        EmulateInstruction::Context read_data_context = {EmulateInstruction::eContextReadMemory, 0, 0, 0};
-        success = false;
-        data = emulator->ReadMemoryUnsigned(read_data_context, addr, 4, 0, &success);
+        data = emulator->ReadMemoryUnsigned(context, addr, 4, 0, &success);
         if (!success)
-            return false;
-
-        EmulateInstruction::Context context = { EmulateInstruction::eContextImmediate,
-                                                eRegisterKindDWARF,
-                                                dwarf_r0 + Rd,
-                                                data };
-    
+            return false;    
         if (!emulator->WriteRegisterUnsigned (context, eRegisterKindDWARF, dwarf_r0 + Rd, data))
             return false;
     }





More information about the lldb-commits mailing list