sagar created this revision. sagar added reviewers: clayborg, tberghammer. sagar added subscribers: nitesh.jain, jaydeep, bhushan, mohit.bhakkad, lldb-commits. sagar set the repository for this revision to rL LLVM. Herald added a subscriber: dsanders.
This patch will clear bug 25194 - LLDB-Server Assertion raised when single stepping on MIPS. The problem was that while emulating instructions, old and new pc values would have garbage value in their upper 32 bits. Therefore checking if pc was changed (old_pc == new_pc) would always return false, because of which pc was not getting updated. > /* If we haven't changed the PC, change it here */ > if (old_pc == new_pc) > { > new_pc += 4; > Context context; > if (!WriteRegisterUnsigned (context, eRegisterKindDWARF, > >dwarf_pc_mips, new_pc)) > return false; > } Repository: rL LLVM http://reviews.llvm.org/D14633 Files: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h =================================================================== --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h @@ -80,6 +80,12 @@ return SupportsEmulatingInstructionsOfTypeStatic (inst_type); } + uint32_t + ReadRegisterUnsigned (lldb::RegisterKind reg_kind, + uint32_t reg_num, + uint32_t fail_value, + bool *success_ptr); + bool ReadInstruction () override; Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp =================================================================== --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -760,6 +760,20 @@ return false; } +uint32_t +EmulateInstructionMIPS::ReadRegisterUnsigned (lldb::RegisterKind reg_kind, + uint32_t reg_num, + uint32_t fail_value, + bool *success_ptr) +{ + RegisterValue reg_value; + if (ReadRegister (reg_kind, reg_num, reg_value)) + return reg_value.GetAsUInt32(fail_value, success_ptr); + if (success_ptr) + *success_ptr = false; + return fail_value; +} + bool EmulateInstructionMIPS::ReadInstruction () { @@ -817,7 +831,7 @@ if (opcode_data == NULL) return false; - uint64_t old_pc = 0, new_pc = 0; + uint32_t old_pc = 0, new_pc = 0; const bool auto_advance_pc = evaluate_options & eEmulateInstructionOptionAutoAdvancePC; if (auto_advance_pc)
Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h =================================================================== --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h @@ -80,6 +80,12 @@ return SupportsEmulatingInstructionsOfTypeStatic (inst_type); } + uint32_t + ReadRegisterUnsigned (lldb::RegisterKind reg_kind, + uint32_t reg_num, + uint32_t fail_value, + bool *success_ptr); + bool ReadInstruction () override; Index: source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp =================================================================== --- source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -760,6 +760,20 @@ return false; } +uint32_t +EmulateInstructionMIPS::ReadRegisterUnsigned (lldb::RegisterKind reg_kind, + uint32_t reg_num, + uint32_t fail_value, + bool *success_ptr) +{ + RegisterValue reg_value; + if (ReadRegister (reg_kind, reg_num, reg_value)) + return reg_value.GetAsUInt32(fail_value, success_ptr); + if (success_ptr) + *success_ptr = false; + return fail_value; +} + bool EmulateInstructionMIPS::ReadInstruction () { @@ -817,7 +831,7 @@ if (opcode_data == NULL) return false; - uint64_t old_pc = 0, new_pc = 0; + uint32_t old_pc = 0, new_pc = 0; const bool auto_advance_pc = evaluate_options & eEmulateInstructionOptionAutoAdvancePC; if (auto_advance_pc)
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits