Added support for attaching to a remote debug server with the new command:
(lldb) process connect <remote-url>

Currently when you specify a file with the file command it helps us to find
a process plug-in that is suitable for debugging. If you specify a file you
can rely upon this to find the correct debugger plug-in:

% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) process connect connect://localhost:2345
...

If you don't specify a file, you will need to specify the plug-in name that
you wish to use:

% lldb
(lldb) process connect --plugin process.gdb-remote connect://localhost:2345

Other connection URL examples:

(lldb) process connect connect://localhost:2345
(lldb) process connect tcp://127.0.0.1
(lldb) process connect file:///dev/ttyS1

We are currently treating the "connect://host:port" as a way to do raw socket
connections. If there is a URL for this already, please let me know and we
will adopt it.

So now you can connect to a remote debug server with the ProcessGDBRemote
plug-in. After connection, it will ask for the pid info using the "qC" packet
and if it responds with a valid process ID, it will be equivalent to attaching.
If it response with an error or invalid process ID, the LLDB process will be
in a new state: eStateConnected. This allows us to then download a program or
specify the program to run (using the 'A' packet), or specify a process to
attach to (using the "vAttach" packets), or query info about the processes
that might be available.




git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@124846 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 52b2376..769849d 100644
--- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -836,17 +836,20 @@
         
         std::string name;
         std::string value;
+        uint32_t cpu = LLDB_INVALID_CPUTYPE;
+        uint32_t sub = 0;
+    
         while (response.GetNameColonValue(name, value))
         {
             if (name.compare("cputype") == 0)
             {
                 // exception type in big endian hex
-                m_arch.SetCPUType(Args::StringToUInt32 (value.c_str(), LLDB_INVALID_CPUTYPE, 0));
+                cpu = Args::StringToUInt32 (value.c_str(), LLDB_INVALID_CPUTYPE, 0);
             }
             else if (name.compare("cpusubtype") == 0)
             {
                 // exception count in big endian hex
-                m_arch.SetCPUSubtype(Args::StringToUInt32 (value.c_str(), 0, 0));
+                sub = Args::StringToUInt32 (value.c_str(), 0, 0);
             }
             else if (name.compare("ostype") == 0)
             {
@@ -871,6 +874,9 @@
                 m_pointer_byte_size = Args::StringToUInt32 (value.c_str(), 0, 0);
             }
         }
+        
+        if (cpu != LLDB_INVALID_CPUTYPE)
+            m_arch.SetMachOArch (cpu, sub);
     }
     return HostInfoIsValid();
 }