diff options
| author | Ilia K <ki.stfu@gmail.com> | 2015-05-20 10:15:47 +0000 |
|---|---|---|
| committer | Ilia K <ki.stfu@gmail.com> | 2015-05-20 10:15:47 +0000 |
| commit | 38810f430b7e7b4695b3525edfcdee960c82c779 (patch) | |
| tree | 941491d13053e8ca487dc94b74498703e06cc987 /lldb/source | |
| parent | 81496c1dec057780c0076d9a892e11a4248cc203 (diff) | |
| download | bcm5719-llvm-38810f430b7e7b4695b3525edfcdee960c82c779.tar.gz bcm5719-llvm-38810f430b7e7b4695b3525edfcdee960c82c779.zip | |
Fix handling of hijacked events in synchronous mode
Summary:
This patch includes the following changes:
* Fix Target::Launch to handle hijacked event in synchronous mode
* Improve MiStartupOptionsTestCase tests to expect *stopped (MI)
* Add SBProcess::GetStopEventForStopID
* Add ProcessModID::SetStopEventForLastNaturalStopID/GetStopEventForStopID
* Add const qualifier to ProcessModID::GetLastNaturalStopID
* Add SBProcess::GetStopEventForStopID
* Don't broadcast hijacked event in Target::Launch
* Add CMICmnLLDBDebugger::CheckIfNeedToRebroadcastStopEvent/RebroadcastStopEvent
Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/startup_options/
Reviewers: zturner, jingham, clayborg, abidh
Reviewed By: clayborg
Subscribers: abidh, zturner, lldb-commits, clayborg, jingham
Differential Revision: http://reviews.llvm.org/D9371
llvm-svn: 237781
Diffstat (limited to 'lldb/source')
| -rw-r--r-- | lldb/source/API/SBProcess.cpp | 24 | ||||
| -rw-r--r-- | lldb/source/Target/Process.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Target/Target.cpp | 11 |
3 files changed, 31 insertions, 12 deletions
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index c84da7f8ed9..62e1c2913e9 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -603,6 +603,30 @@ SBProcess::GetStopID(bool include_expression_stops) return 0; } +SBEvent +SBProcess::GetStopEventForStopID(uint32_t stop_id) +{ + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + SBEvent sb_event; + EventSP event_sp; + ProcessSP process_sp(GetSP()); + if (process_sp) + { + Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex()); + event_sp = process_sp->GetStopEventForStopID(stop_id); + sb_event.reset(event_sp); + } + + if (log) + log->Printf ("SBProcess(%p)::GetStopEventForStopID (stop_id=%" PRIu32 ") => SBEvent(%p)", + static_cast<void*>(process_sp.get()), + stop_id, + static_cast<void*>(event_sp.get())); + + return sb_event; +} + StateType SBProcess::GetState () { diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 619cd4b956f..d43ce743da9 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1796,6 +1796,7 @@ Process::SetPrivateState (StateType new_state) if (state_changed) { m_private_state.SetValueNoLock (new_state); + EventSP event_sp (new Event (eBroadcastBitStateChanged, new ProcessEventData (shared_from_this(), new_state))); if (StateIsStoppedState(new_state, false)) { // Note, this currently assumes that all threads in the list @@ -1812,15 +1813,18 @@ Process::SetPrivateState (StateType new_state) m_thread_list.DidStop(); m_mod_id.BumpStopID(); + if (!m_mod_id.IsLastResumeForUserExpression()) + m_mod_id.SetStopEventForLastNaturalStopID(event_sp); m_memory_cache.Clear(); if (log) log->Printf("Process::SetPrivateState (%s) stop_id = %u", StateAsCString(new_state), m_mod_id.GetStopID()); } + // Use our target to get a shared pointer to ourselves... if (m_finalize_called && PrivateStateThreadIsValid() == false) - BroadcastEvent (eBroadcastBitStateChanged, new ProcessEventData (shared_from_this(), new_state)); + BroadcastEvent (event_sp); else - m_private_state_broadcaster.BroadcastEvent (eBroadcastBitStateChanged, new ProcessEventData (shared_from_this(), new_state)); + m_private_state_broadcaster.BroadcastEvent (event_sp); } else { diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index f8d547de1e7..6018308d66b 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2617,7 +2617,6 @@ Target::Launch (ProcessLaunchInfo &launch_info, Stream *stream) { if (synchronous_execution || launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == false) { - EventSP event_sp; ListenerSP hijack_listener_sp (launch_info.GetHijackListener()); if (!hijack_listener_sp) { @@ -2626,7 +2625,7 @@ Target::Launch (ProcessLaunchInfo &launch_info, Stream *stream) m_process_sp->HijackProcessEvents(hijack_listener_sp.get()); } - StateType state = m_process_sp->WaitForProcessToStop (NULL, &event_sp, false, hijack_listener_sp.get(), NULL); + StateType state = m_process_sp->WaitForProcessToStop (NULL, NULL, false, hijack_listener_sp.get(), NULL); if (state == eStateStopped) { @@ -2657,14 +2656,6 @@ Target::Launch (ProcessLaunchInfo &launch_info, Stream *stream) error = error2; } } - else - { - assert(synchronous_execution && launch_info.GetFlags().Test(eLaunchFlagStopAtEntry)); - - // Target was stopped at entry as was intended. Need to notify the listeners about it. - m_process_sp->RestoreProcessEvents(); - m_process_sp->HandlePrivateEvent(event_sp); - } } else if (state == eStateExited) { |

