[Lldb-commits] [lldb] r263066 - Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

Ted Woodward via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 9 14:05:17 PST 2016


Author: ted
Date: Wed Mar  9 16:05:17 2016
New Revision: 263066

URL: http://llvm.org/viewvc/llvm-project?rev=263066&view=rev
Log:
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

Modified:
    lldb/trunk/source/Expression/IRExecutionUnit.cpp

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=263066&r1=263065&r2=263066&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Wed Mar  9 16:05:17 2016
@@ -798,15 +798,25 @@ IRExecutionUnit::FindInSymbols(const std
 
                 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)




More information about the lldb-commits mailing list