[Lldb-commits] [lldb] r156680 - in /lldb/trunk/source: Host/common/Host.cpp Target/Target.cpp

Greg Clayton gclayton at apple.com
Fri May 11 17:26:42 PDT 2012


Author: gclayton
Date: Fri May 11 19:26:42 2012
New Revision: 156680

URL: http://llvm.org/viewvc/llvm-project?rev=156680&view=rev
Log:
<rdar://problem/11439169> 

"lldb -a i386" doesn't set the calculator mode correctly if run on a 64 bit system. 

The previous logic always used the current host architecture, not the default architecture. The default arch gets set into a static varaible in lldb_private::Target when an arch is set from the command line:

lldb -a i386

We now use the default arch correctly.


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

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=156680&r1=156679&r2=156680&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Fri May 11 19:26:42 2012
@@ -1227,19 +1227,20 @@
 lldb::TargetSP
 Host::GetDummyTarget (lldb_private::Debugger &debugger)
 {
-    static TargetSP dummy_target;
+    static TargetSP g_dummy_target_sp;
     
-    if (!dummy_target)
+    if (!g_dummy_target_sp)
     {
+        ArchSpec default_arch(Target::GetDefaultArchitecture());
         Error err = debugger.GetTargetList().CreateTarget(debugger, 
                                                           FileSpec(), 
-                                                          Host::GetTargetTriple().AsCString(), 
+                                                          default_arch.GetTriple().getTriple().c_str(),
                                                           false, 
                                                           NULL, 
-                                                          dummy_target);
+                                                          g_dummy_target_sp);
     }
     
-    return dummy_target;
+    return g_dummy_target_sp;
 }
 
 struct ShellInfo

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=156680&r1=156679&r2=156680&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri May 11 19:26:42 2012
@@ -1512,10 +1512,12 @@
 Target::GetDefaultArchitecture ()
 {
     lldb::UserSettingsControllerSP settings_controller_sp (GetSettingsController());
-    
+    ArchSpec default_arch;
     if (settings_controller_sp)
-        return static_cast<Target::SettingsController *>(settings_controller_sp.get())->GetArchitecture ();
-    return ArchSpec();
+        default_arch = static_cast<Target::SettingsController *>(settings_controller_sp.get())->GetArchitecture ();
+    if (!default_arch.IsValid())
+        default_arch = Host::GetArchitecture ();
+    return default_arch;
 }
 
 void





More information about the lldb-commits mailing list