Author: spyffe
Date: Thu May 28 15:06:40 2015
New Revision: 238475

URL: http://llvm.org/viewvc/llvm-project?rev=238475&view=rev
Log:
Don't crash if we don't have a process and need
to check for alternate manglings.

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

Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=238475&r1=238474&r2=238475&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Thu May 28 15:06:40 2015
@@ -237,21 +237,24 @@ IRForTarget::GetFunctionAddress (llvm::F
                 // For example, "std::basic_string<...>" has an alternate 
mangling scheme per
                 // the Itanium C++ ABI.
                 lldb::ProcessSP process_sp = 
m_data_allocator.GetTarget()->GetProcessSP();
-                lldb_private::CPPLanguageRuntime *cpp_runtime = 
process_sp->GetCPPLanguageRuntime();
-                if (cpp_runtime && cpp_runtime->GetAlternateManglings(name, 
alternates))
+                if (process_sp)
                 {
-                    for (size_t i = 0; i < alternates.size(); ++i)
+                    lldb_private::CPPLanguageRuntime *cpp_runtime = 
process_sp->GetCPPLanguageRuntime();
+                    if (cpp_runtime && 
cpp_runtime->GetAlternateManglings(name, alternates))
                     {
-                        const lldb_private::ConstString &alternate_name = 
alternates[i];
-                        if (log)
-                            log->Printf("Looking up address of function \"%s\" 
with alternate name \"%s\"",
-                                        name.GetCString(), 
alternate_name.GetCString());
-                        if ((found_it = m_decl_map->GetFunctionAddress 
(alternate_name, fun_addr)))
+                        for (size_t i = 0; i < alternates.size(); ++i)
                         {
+                            const lldb_private::ConstString &alternate_name = 
alternates[i];
                             if (log)
-                                log->Printf("Found address of function \"%s\" 
with alternate name \"%s\"",
+                                log->Printf("Looking up address of function 
\"%s\" with alternate name \"%s\"",
                                             name.GetCString(), 
alternate_name.GetCString());
-                            break;
+                            if ((found_it = m_decl_map->GetFunctionAddress 
(alternate_name, fun_addr)))
+                            {
+                                if (log)
+                                    log->Printf("Found address of function 
\"%s\" with alternate name \"%s\"",
+                                                name.GetCString(), 
alternate_name.GetCString());
+                                break;
+                            }
                         }
                     }
                 }


_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to