Should provide more useful context info for the emulate_ldr_rd_pc_rel() impl.
The context being that it's a PC relative load.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124460 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/Utility/EmulateInstructionARM.cpp b/source/Plugins/Process/Utility/EmulateInstructionARM.cpp
index 3938e64..b350e07 100644
--- a/source/Plugins/Process/Utility/EmulateInstructionARM.cpp
+++ b/source/Plugins/Process/Utility/EmulateInstructionARM.cpp
@@ -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;
     }