summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-10-18 01:45:30 +0000
committerGreg Clayton <gclayton@apple.com>2010-10-18 01:45:30 +0000
commit19388cfc6e82f54e4b5bb468f87aaba61ac465dc (patch)
tree8c11d6f25d891dedd78ffe240c78f064eae17757 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent0ea1047d51ab984a3cb66789e81b1b3b6b2cca56 (diff)
downloadbcm5719-llvm-19388cfc6e82f54e4b5bb468f87aaba61ac465dc.tar.gz
bcm5719-llvm-19388cfc6e82f54e4b5bb468f87aaba61ac465dc.zip
Fixed debugserver to properly attach to a process by name with the
"vAttachName;<PROCNAME>" packet, and wait for a new process by name to launch with the "vAttachWait;<PROCNAME>". Fixed a few issues with attaching where if DoAttach() returned no error, yet there was no valid process ID, we would deadlock waiting for an event that would never happen. Added a new "process launch" option "--tty" that will launch the process in a new terminal if the Host layer supports the "Host::LaunchInNewTerminal(...)" function. This currently works on MacOSX and will allow the debugging of terminal applications that do complex operations with the terminal. Cleaned up the output when the process resumes, stops and halts to be consistent with the output format. llvm-svn: 116693
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp39
1 files changed, 7 insertions, 32 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3da1d59aa70..4b45bd459f7 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -366,7 +366,6 @@ ProcessGDBRemote::WillLaunchOrAttach ()
return error;
}
-//#define LAUNCH_WITH_LAUNCH_SERVICES 1
//----------------------------------------------------------------------
// Process Control
//----------------------------------------------------------------------
@@ -383,30 +382,6 @@ ProcessGDBRemote::DoLaunch
)
{
Error error;
-#if defined (LAUNCH_WITH_LAUNCH_SERVICES)
- ArchSpec inferior_arch(module->GetArchitecture());
-
- //FileSpec app_file_spec (argv[0]);
- pid_t pid = Host::LaunchInNewTerminal (argv,
- envp,
- &inferior_arch,
- true, // stop at entry
- (launch_flags & eLaunchFlagDisableASLR) != 0);
-
- // Let the app get launched and stopped...
- sleep (1);
-
- if (pid != LLDB_INVALID_PROCESS_ID)
- {
- FileSpec program(argv[0]);
- error = DoAttachToProcessWithName (program.GetFilename().AsCString(), false);
- //error = DoAttachToProcessWithID (pid);
- }
- else
- {
- error.SetErrorString("Host::LaunchApplication(() failed to launch process");
- }
-#else
// ::LogSetBitMask (GDBR_LOG_DEFAULT);
// ::LogSetOptions (LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD);
// ::LogSetLogFile ("/dev/stdout");
@@ -522,7 +497,6 @@ ProcessGDBRemote::DoLaunch
SetID(LLDB_INVALID_PROCESS_ID);
error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n", module->GetFileSpec().GetFilename().AsCString(), module->GetArchitecture().AsCString());
}
-#endif
return error;
}
@@ -646,13 +620,9 @@ ProcessGDBRemote::DidLaunchOrAttach ()
void
ProcessGDBRemote::DidLaunch ()
{
-#if defined (LAUNCH_WITH_LAUNCH_SERVICES)
- DidAttach ();
-#else
DidLaunchOrAttach ();
if (m_dynamic_loader_ap.get())
m_dynamic_loader_ap->DidLaunch();
-#endif
}
Error
@@ -795,9 +765,10 @@ ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait
{
StreamString packet;
- packet.PutCString("vAttach");
if (wait_for_launch)
- packet.PutCString("Wait");
+ packet.PutCString("vAttachWait");
+ else
+ packet.PutCString("vAttachName");
packet.PutChar(';');
packet.PutBytesAsRawHex8(process_name, strlen(process_name), eByteOrderHost, eByteOrderHost);
StringExtractorGDBRemote response;
@@ -835,7 +806,11 @@ ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait
if (pid == LLDB_INVALID_PROCESS_ID)
{
KillDebugserverProcess();
+
+ if (error.Success())
+ error.SetErrorStringWithFormat("unable to attach to process named '%s'", process_name);
}
+
return error;
}
OpenPOWER on IntegriCloud