Skip to content

Commit cba80e0

Browse files
Romaric JODINjchauzi
Romaric JODIN
authored and
jchauzi
committed
dpu: fix unwind not to segv when it can get the symbol of a function
Fix #1
1 parent 088f365 commit cba80e0

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

lldb/source/Plugins/Process/Utility/UnwindDPU.cpp

+14-9
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,21 @@ uint32_t UnwindDPU::DoGetFrameCount() {
9595
// have the good value for r22, but it's normal as its frame is not yet set,
9696
// let's just add 1 to it so that we are sure that it will be seen as the
9797
// youngest one when comparing StackID). pc is in r23.
98-
Function *fct;
98+
Function *fct = NULL;
9999
GetFunction(&fct, first_pc_addr);
100-
lldb::addr_t start_addr = fct->GetAddressRange().GetBaseAddress().GetFileAddress();
101-
if (((first_pc_addr >= start_addr) && (first_pc_addr < (start_addr + 16))) ||
102-
PCIsInstructionReturn(fct, first_pc_addr)) {
103-
prev_frame->cfa++;
104-
RegisterValue reg_r23;
105-
reg_ctx_sp->ReadRegister(reg_ctx_sp->GetRegisterInfoByName("r23"), reg_r23);
106-
SetFrame(&prev_frame, first_r22_value, FORMAT_PC(reg_r23.GetAsUInt32()),
107-
reg_ctx_sp);
100+
if (fct != NULL) {
101+
lldb::addr_t start_addr =
102+
fct->GetAddressRange().GetBaseAddress().GetFileAddress();
103+
if (((first_pc_addr >= start_addr) &&
104+
(first_pc_addr < (start_addr + 16))) ||
105+
PCIsInstructionReturn(fct, first_pc_addr)) {
106+
prev_frame->cfa++;
107+
RegisterValue reg_r23;
108+
reg_ctx_sp->ReadRegister(reg_ctx_sp->GetRegisterInfoByName("r23"),
109+
reg_r23);
110+
SetFrame(&prev_frame, first_r22_value, FORMAT_PC(reg_r23.GetAsUInt32()),
111+
reg_ctx_sp);
112+
}
108113
}
109114

110115
while (true) {

0 commit comments

Comments
 (0)