diff options
author | Jim Ingham <jingham@apple.com> | 2013-04-30 23:46:08 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2013-04-30 23:46:08 +0000 |
commit | a23f73dbbcbc6008162767d64bb019389e6a1bd7 (patch) | |
tree | 0ce26237946ccfc99aa54c9f17b996201de04fd2 /lldb/source/Target/Process.cpp | |
parent | 3ca3cd1ed7f37eef0f9e9c0b39d64ee2d12815b4 (diff) | |
download | bcm5719-llvm-a23f73dbbcbc6008162767d64bb019389e6a1bd7.tar.gz bcm5719-llvm-a23f73dbbcbc6008162767d64bb019389e6a1bd7.zip |
Added an option to "process detach" to keep the process stopped, if the process plugin (or in the
case of ProcessGDBRemote the stub we are talking to) know how to do that.
rdar://problem/13680832
llvm-svn: 180831
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r-- | lldb/source/Target/Process.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index f60adca741e..e0ea32a021e 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -101,6 +101,7 @@ g_properties[] = { "unwind-on-error-in-expressions", OptionValue::eTypeBoolean, true, true, NULL, NULL, "If true, errors in expression evaluation will unwind the stack back to the state before the call." }, { "python-os-plugin-path", OptionValue::eTypeFileSpec, false, true, NULL, NULL, "A path to a python OS plug-in module file that contains a OperatingSystemPlugIn class." }, { "stop-on-sharedlibrary-events" , OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, stop when a shared library is loaded or unloaded." }, + { "detach-keeps-stopped" , OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, detach will attempt to keep the process stopped." }, { NULL , OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL } }; @@ -110,7 +111,8 @@ enum { ePropertyIgnoreBreakpointsInExpressions, ePropertyUnwindOnErrorInExpressions, ePropertyPythonOSPluginPath, - ePropertyStopOnSharedLibraryEvents + ePropertyStopOnSharedLibraryEvents, + ePropertyDetachKeepsStopped }; ProcessProperties::ProcessProperties (bool is_global) : @@ -213,6 +215,20 @@ ProcessProperties::SetStopOnSharedLibraryEvents (bool stop) m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, stop); } +bool +ProcessProperties::GetDetachKeepsStopped () const +{ + const uint32_t idx = ePropertyDetachKeepsStopped; + return m_collection_sp->GetPropertyAtIndexAsBoolean(NULL, idx, g_properties[idx].default_uint_value != 0); +} + +void +ProcessProperties::SetDetachKeepsStopped (bool stop) +{ + const uint32_t idx = ePropertyDetachKeepsStopped; + m_collection_sp->SetPropertyAtIndexAsBoolean(NULL, idx, stop); +} + void ProcessInstanceInfo::Dump (Stream &s, Platform *platform) const { @@ -1096,7 +1112,11 @@ Process::Finalize() case eStateCrashed: case eStateSuspended: if (GetShouldDetach()) - Detach(); + { + // FIXME: This will have to be a process setting: + bool keep_stopped = false; + Detach(keep_stopped); + } else Destroy(); break; @@ -3431,7 +3451,7 @@ Process::HaltForDestroyOrDetach(lldb::EventSP &exit_event_sp) } Error -Process::Detach () +Process::Detach (bool keep_stopped) { EventSP exit_event_sp; Error error; @@ -3458,12 +3478,16 @@ Process::Detach () } } - error = DoDetach(); + error = DoDetach(keep_stopped); if (error.Success()) { DidDetach(); StopPrivateStateThread(); } + else + { + return error; + } } m_destroy_in_process = false; |