Page MenuHomePhabricator

[MIPS] Software single stepping
ClosedPublic

Authored by jaydeep on May 6 2015, 2:35 AM.

Details

Summary

ReadRegisterCallback() has been modified to keep m_register_values intact. The function should not update m_register_values, because when EvaluateInstruction() fails to emulate an instruction then the following condition fails: (as we have stored PC in m_register_values).

else if (pc_it == baton.m_register_values.end())

{
    // Emulate instruction failed and it haven't changed PC. Advance PC
    // with the size of the current opcode because the emulation of all
    // PC modifying instruction should be successful. The failure most
    // likely caused by a not supported instruction which don't modify PC.
    next_pc = register_context_sp->GetPC() + emulator_ap->GetOpcode().GetByteSize();
    next_flags = ReadFlags (register_context_sp.get());
}

EvaluateInstruction() hasn’t modified the PC, it was ReadRegisterCallback() who modified it.

EmulateInstructionMIPS64() has been modified to initialize MIPS targets and disassemblers (when not initialized). When the full system initializer is not called, none of the targets and disassemblers is available. We would like to use LLVM disassembler so that the complexity stays with LLVM.

Diff Detail

Repository
rL LLVM

Event Timeline

jaydeep updated this revision to Diff 25023.May 6 2015, 2:35 AM
jaydeep retitled this revision from to [MIPS] Software single stepping.
jaydeep updated this object.
jaydeep edited the test plan for this revision. (Show Details)
jaydeep added reviewers: clayborg, jasonmolenda.
jaydeep set the repository for this revision to rL LLVM.
jaydeep added subscribers: bhushan, slthakur, mohit.bhakkad.
jaydeep added a subscriber: Unknown Object (MLST).
clayborg accepted this revision.May 6 2015, 9:33 AM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.May 6 2015, 9:33 AM
This revision was automatically updated to reflect the committed changes.