Skip to content

Commit

Permalink
dpu: fix unwind not to segv when it can get the symbol of a function
Browse files Browse the repository at this point in the history
Fix #1
  • Loading branch information
Romaric JODIN authored and jchauzi committed Aug 5, 2019
1 parent 088f365 commit cba80e0
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lldb/source/Plugins/Process/Utility/UnwindDPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,21 @@ uint32_t UnwindDPU::DoGetFrameCount() {
// have the good value for r22, but it's normal as its frame is not yet set,
// let's just add 1 to it so that we are sure that it will be seen as the
// youngest one when comparing StackID). pc is in r23.
Function *fct;
Function *fct = NULL;
GetFunction(&fct, first_pc_addr);
lldb::addr_t start_addr = fct->GetAddressRange().GetBaseAddress().GetFileAddress();
if (((first_pc_addr >= start_addr) && (first_pc_addr < (start_addr + 16))) ||
PCIsInstructionReturn(fct, first_pc_addr)) {
prev_frame->cfa++;
RegisterValue reg_r23;
reg_ctx_sp->ReadRegister(reg_ctx_sp->GetRegisterInfoByName("r23"), reg_r23);
SetFrame(&prev_frame, first_r22_value, FORMAT_PC(reg_r23.GetAsUInt32()),
reg_ctx_sp);
if (fct != NULL) {
lldb::addr_t start_addr =
fct->GetAddressRange().GetBaseAddress().GetFileAddress();
if (((first_pc_addr >= start_addr) &&
(first_pc_addr < (start_addr + 16))) ||
PCIsInstructionReturn(fct, first_pc_addr)) {
prev_frame->cfa++;
RegisterValue reg_r23;
reg_ctx_sp->ReadRegister(reg_ctx_sp->GetRegisterInfoByName("r23"),
reg_r23);
SetFrame(&prev_frame, first_r22_value, FORMAT_PC(reg_r23.GetAsUInt32()),
reg_ctx_sp);
}
}

while (true) {
Expand Down

0 comments on commit cba80e0

Please sign in to comment.