diff options
| author | Greg Clayton <gclayton@apple.com> | 2010-10-18 01:45:30 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2010-10-18 01:45:30 +0000 |
| commit | 19388cfc6e82f54e4b5bb468f87aaba61ac465dc (patch) | |
| tree | 8c11d6f25d891dedd78ffe240c78f064eae17757 /lldb/tools/debugserver/source/RNBRemote.cpp | |
| parent | 0ea1047d51ab984a3cb66789e81b1b3b6b2cca56 (diff) | |
| download | bcm5719-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/tools/debugserver/source/RNBRemote.cpp')
| -rw-r--r-- | lldb/tools/debugserver/source/RNBRemote.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp index 986cb4f5035..f8dab016b6a 100644 --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -138,6 +138,7 @@ RNBRemote::CreatePacketTable () t.push_back (Packet (thread_alive_p, &RNBRemote::HandlePacket_T, NULL, "T", "Is thread alive")); t.push_back (Packet (vattach, &RNBRemote::HandlePacket_v, NULL, "vAttach", "Attach to a new process")); t.push_back (Packet (vattachwait, &RNBRemote::HandlePacket_v, NULL, "vAttachWait", "Wait for a process to start up then attach to it")); + t.push_back (Packet (vattachname, &RNBRemote::HandlePacket_v, NULL, "vAttachName", "Attach to an existing process by name")); t.push_back (Packet (vcont_list_actions, &RNBRemote::HandlePacket_v, NULL, "vCont;", "Verbose resume with thread actions")); t.push_back (Packet (vcont_list_actions, &RNBRemote::HandlePacket_v, NULL, "vCont?", "List valid continue-with-thread-actions actions")); // The X packet doesn't currently work. If/when it does, remove the line above and uncomment out the line below @@ -2551,6 +2552,31 @@ RNBRemote::HandlePacket_v (const char *p) attach_pid = DNBProcessAttachWait(attach_name.c_str (), m_ctx.LaunchFlavor(), NULL, 1000, err_str, sizeof(err_str), RNBRemoteShouldCancelCallback); } + if (strstr (p, "vAttachName;") == p) + { + p += strlen("vAttachName;"); + std::string attach_name; + while (*p != '\0') + { + char smallbuf[3]; + smallbuf[0] = *p; + smallbuf[1] = *(p + 1); + smallbuf[2] = '\0'; + + errno = 0; + int ch = strtoul (smallbuf, NULL, 16); + if (errno != 0 && ch == 0) + { + return HandlePacket_ILLFORMED ("non-hex char in arg on 'vAttachWait' pkt"); + } + + attach_name.push_back(ch); + p += 2; + } + + attach_pid = DNBProcessAttachByName (attach_name.c_str(), NULL, err_str, sizeof(err_str)); + + } else if (strstr (p, "vAttach;") == p) { p += strlen("vAttach;"); |

