summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2014-03-29 18:54:20 +0000
committerJason Molenda <jmolenda@apple.com>2014-03-29 18:54:20 +0000
commita332978b2ab53306acdef10858c7e954e605ab37 (patch)
treedb0802288ce9a50156d440b82ae606eae60cf129 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent61e595be4dcd9e63bc3a2b6787ffb647457969cd (diff)
downloadbcm5719-llvm-a332978b2ab53306acdef10858c7e954e605ab37.tar.gz
bcm5719-llvm-a332978b2ab53306acdef10858c7e954e605ab37.zip
lldb arm64 import.
These changes were written by Greg Clayton, Jim Ingham, Jason Molenda. It builds cleanly against TOT llvm with xcodebuild. I updated the cmake files by visual inspection but did not try a build. I haven't built these sources on any non-Mac platforms - I don't think this patch adds any code that requires darwin, but please let me know if I missed something. In debugserver, MachProcess.cpp and MachTask.cpp were renamed to MachProcess.mm and MachTask.mm as they picked up some new Objective-C code needed to launch processes when running on iOS. llvm-svn: 205113
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp50
1 files changed, 46 insertions, 4 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 1bee5806e5f..48db3b0ffae 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -800,6 +800,10 @@ ProcessGDBRemote::DoLaunch (Module *exe_module, ProcessLaunchInfo &launch_info)
m_gdb_comm.SendLaunchArchPacket (m_target.GetArchitecture().GetArchitectureName());
+ const char * launch_event_data = launch_info.GetLaunchEventData();
+ if (launch_event_data != NULL && *launch_event_data != '\0')
+ m_gdb_comm.SendLaunchEventDataPacket (launch_event_data);
+
if (working_dir && working_dir[0])
{
m_gdb_comm.SetWorkingDir (working_dir);
@@ -2608,7 +2612,7 @@ ProcessGDBRemote::LaunchAndConnectToDebugserver (const ProcessInfo &process_info
debugserver_launch_info.SetMonitorProcessCallback (MonitorDebugserverProcess, this, false);
debugserver_launch_info.SetUserID(process_info.GetUserID());
-#if defined (__APPLE__) && defined (__arm__)
+#if defined (__APPLE__) && (defined (__arm__) || defined (__arm64__))
// On iOS, still do a local connection using a random port
const char *hostname = "127.0.0.1";
uint16_t port = get_random_port ();
@@ -2924,13 +2928,33 @@ ProcessGDBRemote::AsyncThread (void *arg)
break;
case eStateExited:
+ {
process->SetLastStopPacket (response);
process->ClearThreadIDList();
response.SetFilePos(1);
- process->SetExitStatus(response.GetHexU8(), NULL);
+
+ int exit_status = response.GetHexU8();
+ const char *desc_cstr = NULL;
+ StringExtractor extractor;
+ std::string desc_string;
+ if (response.GetBytesLeft() > 0 && response.GetChar('-') == ';')
+ {
+ std::string desc_token;
+ while (response.GetNameColonValue (desc_token, desc_string))
+ {
+ if (desc_token == "description")
+ {
+ extractor.GetStringRef().swap(desc_string);
+ extractor.SetFilePos(0);
+ extractor.GetHexByteString (desc_string);
+ desc_cstr = desc_string.c_str();
+ }
+ }
+ }
+ process->SetExitStatus(exit_status, desc_cstr);
done = true;
break;
-
+ }
case eStateInvalid:
process->SetExitStatus(-1, "lost connection");
break;
@@ -3066,6 +3090,25 @@ ProcessGDBRemote::GetDynamicLoader ()
return m_dyld_ap.get();
}
+Error
+ProcessGDBRemote::SendEventData(const char *data)
+{
+ int return_value;
+ bool was_supported;
+
+ Error error;
+
+ return_value = m_gdb_comm.SendLaunchEventDataPacket (data, &was_supported);
+ if (return_value != 0)
+ {
+ if (!was_supported)
+ error.SetErrorString("Sending events is not supported for this process.");
+ else
+ error.SetErrorStringWithFormat("Error sending event data: %d.", return_value);
+ }
+ return error;
+}
+
const DataBufferSP
ProcessGDBRemote::GetAuxvData()
{
@@ -3079,7 +3122,6 @@ ProcessGDBRemote::GetAuxvData()
return buf;
}
-
class CommandObjectProcessGDBRemotePacketHistory : public CommandObjectParsed
{
private:
OpenPOWER on IntegriCloud