omjavaid created this revision.
omjavaid added reviewers: lldb-commits, clayborg, vharron, tberghammer.

This patch fixes a bug which was causing test failures on remote targets.

LLDB was select default platform instead of currently select target platform 
due to which following use case ended up launching a local debug server instead 
of spawning a server on currently connect + select platform.
file a.out
target select remote-linux
target connect connect://hostname:5432
run

on issuing run command lldb will launch the target with old platform pointer 
select by default on creating Target with command file a.out.

This patch fixes this behavior by updating the sp_platform to currently 
selected platform making sure we launch debugserver on the right platform.

This should fix all remote tests that issues a command sequence following a 
file command.

http://reviews.llvm.org/D11129

Files:
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===================================================================
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2545,7 +2545,7 @@
     Debugger &debugger = GetDebugger();
     const bool synchronous_execution = 
debugger.GetCommandInterpreter().GetSynchronous ();
     
-    PlatformSP platform_sp (GetPlatform());
+    const auto platform_sp = GetDebugger ().GetPlatformList 
().GetSelectedPlatform ();
     
     // Finalize the file actions, and if none were given, default to opening
     // up a pseudo terminal
@@ -2577,6 +2577,7 @@
         if (log)
             log->Printf ("Target::%s asking the platform to debug the 
process", __FUNCTION__);
 
+        SetPlatform (platform_sp);
         // Get a weak pointer to the previous process if we have one
         ProcessWP process_wp;
         if (m_process_sp)


Index: source/Target/Target.cpp
===================================================================
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2545,7 +2545,7 @@
     Debugger &debugger = GetDebugger();
     const bool synchronous_execution = debugger.GetCommandInterpreter().GetSynchronous ();
     
-    PlatformSP platform_sp (GetPlatform());
+    const auto platform_sp = GetDebugger ().GetPlatformList ().GetSelectedPlatform ();
     
     // Finalize the file actions, and if none were given, default to opening
     // up a pseudo terminal
@@ -2577,6 +2577,7 @@
         if (log)
             log->Printf ("Target::%s asking the platform to debug the process", __FUNCTION__);
 
+        SetPlatform (platform_sp);
         // Get a weak pointer to the previous process if we have one
         ProcessWP process_wp;
         if (m_process_sp)
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to