summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-02-04 01:58:07 +0000
committerGreg Clayton <gclayton@apple.com>2011-02-04 01:58:07 +0000
commitb766a73dfc5c26e61d0d12bebfea04ab6aba7e4f (patch)
tree365b1a95f6bbc2f88dd6cbe3eeb006f503f371b3 /lldb/source/Target/Process.cpp
parent26ffa0188923fa4e16190d7e6eacf8f0142e618c (diff)
downloadbcm5719-llvm-b766a73dfc5c26e61d0d12bebfea04ab6aba7e4f.tar.gz
bcm5719-llvm-b766a73dfc5c26e61d0d12bebfea04ab6aba7e4f.zip
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. llvm-svn: 124846
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 658280c83e4..0df8077b75f 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1737,6 +1737,49 @@ Process::Attach (const char *process_name, bool wait_for_launch)
}
Error
+Process::ConnectRemote (const char *remote_url)
+{
+ m_target_triple.Clear();
+ m_abi_sp.reset();
+ m_process_input_reader.reset();
+
+ // Find the process and its architecture. Make sure it matches the architecture
+ // of the current Target, and if not adjust it.
+
+ Error error (DoConnectRemote (remote_url));
+ if (error.Success())
+ {
+ SetNextEventAction(new Process::AttachCompletionHandler(this));
+ StartPrivateStateThread();
+// TimeValue timeout;
+// timeout = TimeValue::Now();
+// timeout.OffsetWithMicroSeconds(000);
+// EventSP event_sp;
+// StateType state = WaitForProcessStopPrivate(NULL, event_sp);
+//
+// if (state == eStateStopped || state == eStateCrashed)
+// {
+// DidLaunch ();
+//
+// // This delays passing the stopped event to listeners till DidLaunch gets
+// // a chance to complete...
+// HandlePrivateEvent (event_sp);
+// StartPrivateStateThread ();
+// }
+// else if (state == eStateExited)
+// {
+// // We exited while trying to launch somehow. Don't call DidLaunch as that's
+// // not likely to work, and return an invalid pid.
+// HandlePrivateEvent (event_sp);
+// }
+//
+// StartPrivateStateThread();
+ }
+ return error;
+}
+
+
+Error
Process::Resume ()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
@@ -1948,6 +1991,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
switch (state)
{
+ case eStateConnected:
case eStateAttaching:
case eStateLaunching:
case eStateDetached:
OpenPOWER on IntegriCloud