diff options
author | Ted Woodward <ted.woodward@codeaurora.org> | 2016-03-09 22:05:17 +0000 |
---|---|---|
committer | Ted Woodward <ted.woodward@codeaurora.org> | 2016-03-09 22:05:17 +0000 |
commit | eee554d86ed2407623421d3aa3bac1f8e0d9e2ae (patch) | |
tree | b1914072ecdb4ddad4a002ae767aac6bcb9b3916 /lldb/source/Expression/IRExecutionUnit.cpp | |
parent | 5f58c27d790182276cc32a511903a7d278675daa (diff) | |
download | bcm5719-llvm-eee554d86ed2407623421d3aa3bac1f8e0d9e2ae.tar.gz bcm5719-llvm-eee554d86ed2407623421d3aa3bac1f8e0d9e2ae.zip |
Fix "ninja check-lldb" crash in IRExecutionUnit.cpp
Summary:
From Adrian McCarthy:
"Running ninja check-lldb now has one crash in a Python process, due to deferencing a null pointer in IRExecutionUnit.cpp: candidate_sc.symbol is null, which leads to a call with a null this pointer."
Reviewers: zturner, spyffe, amccarth
Subscribers: ted, jingham, lldb-commits
Differential Revision: http://reviews.llvm.org/D17860
llvm-svn: 263066
Diffstat (limited to 'lldb/source/Expression/IRExecutionUnit.cpp')
-rw-r--r-- | lldb/source/Expression/IRExecutionUnit.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index 4ae1a4c65db..6b223fd5c1b 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -798,15 +798,25 @@ IRExecutionUnit::FindInSymbols(const std::vector<IRExecutionUnit::SearchSpec> &s const bool is_external = (candidate_sc.function) || (candidate_sc.symbol && candidate_sc.symbol->IsExternal()); + if (candidate_sc.symbol) + { + load_address = candidate_sc.symbol->ResolveCallableAddress(*target); - load_address = candidate_sc.symbol->ResolveCallableAddress(*target); + if (load_address == LLDB_INVALID_ADDRESS) + { + if (target->GetProcessSP()) + load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target); + else + load_address = candidate_sc.symbol->GetAddress().GetFileAddress(); + } + } - if (load_address == LLDB_INVALID_ADDRESS) + if (load_address == LLDB_INVALID_ADDRESS && candidate_sc.function) { - if (target->GetProcessSP()) - load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target); - else - load_address = candidate_sc.symbol->GetAddress().GetFileAddress(); + if (target->GetProcessSP()) + load_address = candidate_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(target); + else + load_address = candidate_sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); } if (load_address != LLDB_INVALID_ADDRESS) |