Skip to content

Commit

Permalink
Revert "Fix race during process interruption"
Browse files Browse the repository at this point in the history
The android buildbot gets quite flaky after this change. I'm reverting it while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@254430 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
labath committed Dec 1, 2015
1 parent 156ce46 commit 911e9a9
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 108 deletions.
27 changes: 12 additions & 15 deletions include/lldb/Target/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,6 @@ class Process :

Error
ResumeSynchronous (Stream *stream);

//------------------------------------------------------------------
/// Halts a running process.
///
Expand All @@ -1368,15 +1367,12 @@ class Process :
/// @param[in] clear_thread_plans
/// If true, when the process stops, clear all thread plans.
///
/// @param[in] use_run_lock
/// Whether to release the run lock after the stop.
///
/// @return
/// Returns an error object. If the error is empty, the process is halted.
/// otherwise the halt has failed.
//------------------------------------------------------------------
Error
Halt (bool clear_thread_plans = false, bool use_run_lock = true);
Halt (bool clear_thread_plans = false);

//------------------------------------------------------------------
/// Detaches from a running or stopped process.
Expand Down Expand Up @@ -1687,8 +1683,9 @@ class Process :
/// DoHalt must produce one and only one stop StateChanged event if it actually
/// stops the process. If the stop happens through some natural event (for
/// instance a SIGSTOP), then forwarding that event will do. Otherwise, you must
/// generate the event manually. This function is called from the context of the
/// private state thread.
/// generate the event manually. Note also, the private event thread is stopped when
/// DoHalt is run to prevent the events generated while halting to trigger
/// other state changes before the halt is complete.
///
/// @param[out] caused_stop
/// If true, then this Halt caused the stop, otherwise, the
Expand Down Expand Up @@ -2864,16 +2861,12 @@ class Process :
// Returns the process state when it is stopped. If specified, event_sp_ptr
// is set to the event which triggered the stop. If wait_always = false,
// and the process is already stopped, this function returns immediately.
// If the process is hijacked and use_run_lock is true (the default), then this
// function releases the run lock after the stop. Setting use_run_lock to false
// will avoid this behavior.
lldb::StateType
WaitForProcessToStop(const TimeValue *timeout,
lldb::EventSP *event_sp_ptr = nullptr,
bool wait_always = true,
Listener *hijack_listener = nullptr,
Stream *stream = nullptr,
bool use_run_lock = true);
Stream *stream = nullptr);

uint32_t
GetIOHandlerID () const
Expand Down Expand Up @@ -3288,6 +3281,12 @@ class Process :
std::string m_exit_string;
};

bool
HijackPrivateProcessEvents (Listener *listener);

void
RestorePrivateProcessEvents ();

bool
PrivateStateThreadIsValid () const
{
Expand Down Expand Up @@ -3373,6 +3372,7 @@ class Process :
std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
ProcessRunLock m_public_run_lock;
ProcessRunLock m_private_run_lock;
Predicate<bool> m_currently_handling_event; // This predicate is set in HandlePrivateEvent while all its business is being done.
ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
bool m_currently_handling_do_on_removals;
bool m_resume_requested; // If m_currently_handling_event or m_currently_handling_do_on_removals are true, Resume will only request a resume, using this flag to check.
Expand Down Expand Up @@ -3436,9 +3436,6 @@ class Process :
void
HandlePrivateEvent (lldb::EventSP &event_sp);

Error
HaltPrivate();

lldb::StateType
WaitForProcessStopPrivate (const TimeValue *timeout, lldb::EventSP &event_sp);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ def test(self):

frame = thread.GetFrameAtIndex(0)

value = frame.EvaluateExpression ("wait_a_while (200000)", options)
value = frame.EvaluateExpression ("wait_a_while (50000)", options)
self.assertTrue (value.IsValid())
self.assertFalse (value.GetError().Success())

# Now do the same thing with the command line command, and make sure it works too.
interp = self.dbg.GetCommandInterpreter()

result = lldb.SBCommandReturnObject()
return_value = interp.HandleCommand ("expr -t 100 -u true -- wait_a_while(200000)", result)
return_value = interp.HandleCommand ("expr -t 100 -u true -- wait_a_while(50000)", result)
self.assertTrue (return_value == lldb.eReturnStatusFailed)

# Okay, now do it again with long enough time outs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class AttachResumeTestCase(TestBase):
@skipIfRemote
@expectedFailureFreeBSD('llvm.org/pr19310')
@expectedFailureWindows("llvm.org/pr24778")
@expectedFlakeyLinux('llvm.org/pr19310')
def test_attach_continue_interrupt_detach(self):
"""Test attach/continue/interrupt/detach"""
self.build()
Expand Down Expand Up @@ -51,9 +52,6 @@ def process_attach_continue_interrupt_detach(self):
self.runCmd("process interrupt")
lldbutil.expect_state_changes(self, listener, [lldb.eStateStopped])

# Second interrupt should have no effect.
self.expect("process interrupt", patterns=["Process is not running"], error=True)

# check that this breakpoint is auto-cleared on detach (r204752)
self.runCmd("br set -f main.cpp -l %u" % (line_number('main.cpp', '// Set breakpoint here')))

Expand Down
Loading

0 comments on commit 911e9a9

Please sign in to comment.