This is an archive of the discontinued LLVM Phabricator instance.

Fix prologue and epilogue handling in UnwindAssemblyInstEmulation
AbandonedPublic

Authored by tberghammer on May 13 2015, 2:52 AM.

Details

Summary

Fix prologue and epilogue handling in UnwindAssemblyInstEmulation

Diff Detail

Event Timeline

tberghammer retitled this revision from to Fix prologue and epilogue handling in UnwindAssemblyInstEmulation.
tberghammer updated this object.
tberghammer edited the test plan for this revision. (Show Details)
tberghammer added a reviewer: jasonmolenda.
tberghammer added a subscriber: Unknown Object (MLST).

Added some inline comment to explain the reason behind each change

source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
162–196

We have to create the new CFA row before processing the instruction following the return-to-caller instruction so it will be valid for the instruction immediately after the return-to-caller instruction and if the next instruction change the CFA then it have the correct base information.

This have to be done even if the current instruction will change the CFA row to have the right data for the current instruction.

175

When we create a new row from the saved prologue CFA row we should start it from the current instruction, not from the next one.

Previously it was:

m_curr_row->SetOffset (inst->GetAddress().GetFileAddress() + inst->GetOpcode().GetByteSize() - base_addr);
257–265

We have to save the prologue CFA also if the last instruction changed the CFA because when the following instruction is detected as part of the epilogue then the prologue CFA will never be saved.

641–642

eContextRegisterLoad can happen as part of the prologue when the value of some register is initialized with constants. On android-arm it is done by loading data from a PC relative address with the LDR instruction using the mixed code and data segments.

source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h
186–187

This variable only used to detect when we can't be in the prologue because of an instruction what should only appear in the epilogue. Rename it accordingly.

tberghammer abandoned this revision.Jun 11 2015, 6:15 PM

Abandon because of an upcoming patch fixing this issue and several other issue also