[Lldb-commits] [PATCH] D17860: Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

Ted Woodward via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 3 10:58:56 PST 2016


ted created this revision.
ted added reviewers: spyffe, zturner, amccarth.
ted added a subscriber: lldb-commits.

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."

http://reviews.llvm.org/D17860

Files:
  source/Expression/IRExecutionUnit.cpp

Index: source/Expression/IRExecutionUnit.cpp
===================================================================
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -796,27 +796,28 @@
 
                 sc_list.GetContextAtIndex(si, candidate_sc);
 
-                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 (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 (is_external)
-                    {
-                        return true;
-                    }
-                    else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
+                    if (load_address != LLDB_INVALID_ADDRESS)
                     {
-                        best_internal_load_address = load_address;
-                        load_address = LLDB_INVALID_ADDRESS;
+                        if (candidate_sc.function || candidate_sc.symbol->IsExternal())
+                        {
+                            return true;
+                        }
+                        else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
+                        {
+                            best_internal_load_address = load_address;
+                            load_address = LLDB_INVALID_ADDRESS;
+                        }
                     }
                 }
             }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17860.49759.patch
Type: text/x-patch
Size: 2385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160303/e06f48a5/attachment.bin>


More information about the lldb-commits mailing list