[Lldb-commits] [lldb] r156994 - /lldb/trunk/source/Host/common/Host.cpp

Filipe Cabecinhas me at filcab.net
Thu May 17 08:48:03 PDT 2012


Author: filcab
Date: Thu May 17 10:48:02 2012
New Revision: 156994

URL: http://llvm.org/viewvc/llvm-project?rev=156994&view=rev
Log:
We shouldn't save g_dummy_target_sp. Other code will simply call Destroy() on it.

TestBackticksWithoutATarget.BackticksWithNoTargetTestCase was calling
GetDummyTarget() when executing for x86_64. When performing session
tearDown, it would get destroyed (and everything would be invalid (arch,
etc).

Then the test would run for i386. The dummy target wasn't being
reinitialized and was invalid. lldb complained that 'current process state
is unsuitable for expression parsing'.

Modified:
    lldb/trunk/source/Host/common/Host.cpp

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=156994&r1=156993&r2=156994&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Thu May 17 10:48:02 2012
@@ -1227,22 +1227,19 @@
 lldb::TargetSP
 Host::GetDummyTarget (lldb_private::Debugger &debugger)
 {
-    static TargetSP g_dummy_target_sp;
-    
-    if (!g_dummy_target_sp)
-    {
-        ArchSpec arch(Target::GetDefaultArchitecture());
-        if (!arch.IsValid())
-            arch = Host::GetArchitecture ();
-        Error err = debugger.GetTargetList().CreateTarget(debugger, 
-                                                          FileSpec(), 
-                                                          arch.GetTriple().getTriple().c_str(),
-                                                          false, 
-                                                          NULL, 
-                                                          g_dummy_target_sp);
-    }
-    
-    return g_dummy_target_sp;
+    lldb::TargetSP dummy_target_sp;
+
+    ArchSpec arch(Target::GetDefaultArchitecture());
+    if (!arch.IsValid())
+        arch = Host::GetArchitecture ();
+    Error err = debugger.GetTargetList().CreateTarget(debugger, 
+                                                      FileSpec(), 
+                                                      arch.GetTriple().getTriple().c_str(),
+                                                      false, 
+                                                      NULL, 
+                                                      dummy_target_sp);
+
+    return dummy_target_sp;
 }
 
 struct ShellInfo





More information about the lldb-commits mailing list