This is an archive of the discontinued LLVM Phabricator instance.

Auto advance pc for signle stepping on arm when emulation failes
ClosedPublic

Authored by tberghammer on Apr 17 2015, 5:34 AM.

Details

Summary

Auto advance pc for single stepping on arm when emulation fails

The arm instruction emulation handles only some of the opcode (including
all of them modifying the PC). For the rest of the instructions we can
advance the PC by the size of the instruction as they don't modify the
PC on any other way.

Diff Detail

Repository
rL LLVM

Event Timeline

tberghammer retitled this revision from to Auto advance pc for signle stepping on arm when emulation failes.
tberghammer updated this object.
tberghammer edited the test plan for this revision. (Show Details)
tberghammer added reviewers: omjavaid, ovyalov.
tberghammer added a subscriber: Unknown Object (MLST).
ovyalov accepted this revision.Apr 17 2015, 10:08 AM
ovyalov edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 17 2015, 10:08 AM
omjavaid edited edge metadata.Apr 19 2015, 4:39 PM

Some comments inline.

source/Plugins/Process/Linux/NativeProcessLinux.cpp
3691 ↗(On Diff #23916)

Is this function name intentional? This seems to be a typo as correct register name is CPSR.

3728 ↗(On Diff #23916)

Update function name here as well.

3734 ↗(On Diff #23916)

This actually hides a genuine emulation failure.

May be we can add a check to verify that pc hasnt change before advancing it.

3737 ↗(On Diff #23916)

Please correct ReadCpsr here as well.

This revision was automatically updated to reflect the committed changes.
tberghammer added inline comments.Apr 20 2015, 3:41 AM
source/Plugins/Process/Linux/NativeProcessLinux.cpp
3691 ↗(On Diff #23916)

Fixed

3728 ↗(On Diff #23916)

Done

3734 ↗(On Diff #23916)

Added a check to report error if the emulation is failed after modifying PC (it should never happen on arm based on the current implementation). A proper solution would be to change the return value of EvaluateInstruction to report a proper error code. I will try to fix it sometime in the future.

3737 ↗(On Diff #23916)

Done