This is an archive of the discontinued LLVM Phabricator instance.

[NativeProcessLinux] Remove the post-stop lambda
ClosedPublic

Authored by labath on Apr 28 2015, 4:46 AM.

Details

Summary

The lambda was always calling SetState(eStateStopped) with small variations, so I have inlined
the code. Given that we don't have the TSC anymore, I believe we don't need to be so generic.

The only major change here is the way we choose a stop reason thread when we're interrupting a
program on client request. Previously, we were setting a null stop reason for all threads and
then fixing up the reason for one victim thread in the lambda. Now, I make sure the stop reason
is set for the victim thread correctly in the first place.

I also take the opportunity to rename CallAfter* functions into something more appropriate.

Diff Detail

Repository
rL LLVM

Event Timeline

labath updated this revision to Diff 24540.Apr 28 2015, 4:46 AM
labath retitled this revision from to [NativeProcessLinux] Remove the post-stop lambda.
labath updated this object.
labath edited the test plan for this revision. (Show Details)
labath added reviewers: chaoren, vharron.
labath added a subscriber: Unknown Object (MLST).
vharron edited edge metadata.Apr 28 2015, 10:41 AM

Looks good. What does this change do to flakey tests? Have you run dosep.py 100x?

chaoren edited edge metadata.Apr 28 2015, 10:54 AM

Some preliminary comments:

source/Plugins/Process/Linux/NativeProcessLinux.cpp
2703 ↗(On Diff #24540)

as we they are just

Typo?

2708 ↗(On Diff #24540)

This seems unnecessary. I think

if (...)
    linux_thread_sp->SetStoppedBySignal(SIGSTOP);
else
    linux_thread_sp->SetStoppedBySignal(0);

looks more obvious, and saves a variable (and an assignment).

source/Plugins/Process/Linux/NativeProcessLinux.h
555 ↗(On Diff #24540)

DoStopThreads?

labath updated this revision to Diff 24629.Apr 29 2015, 6:29 AM
labath edited edge metadata.
  • Address review comments
  • Rebase on D9296
labath added inline comments.Apr 29 2015, 6:30 AM
source/Plugins/Process/Linux/NativeProcessLinux.cpp
2708 ↗(On Diff #24540)

Agreed.

source/Plugins/Process/Linux/NativeProcessLinux.h
555 ↗(On Diff #24540)

Changed. In the long run, I plan to get rid of this function anyway.

labath updated this revision to Diff 24734.Apr 30 2015, 9:10 AM

Rebasing...

vharron accepted this revision.Apr 30 2015, 9:40 PM
vharron edited edge metadata.

I ran 50 iterations of "dosep.py -A i386 -A x86_64 -C gcc -C clang-3.5 -C clang-tot" before and after this patch sequence.

before patches


with patches

This has disappeared completely:

ExpectedFailure-i386-gcc-TestExitDuringStep.ExitDuringStepTestCase.test_thread_state_is_stopped_with_dwarf.log

These tests began failing on i386 gcc/clang-tot but were hidden by XFAIL

ThreadStates.ThreadStateTestCase.test_process_interrupt_with_dwarf
ThreadStates.ThreadStateTestCase.test_process_state_with_dwarf
ThreadStates.ThreadStateTestCase.test_state_after_breakpoint_with_dwarf

Please fix these tests and then you're good to submit.

Congratulations.

This revision is now accepted and ready to land.Apr 30 2015, 9:40 PM
vharron added a comment.EditedApr 30 2015, 10:45 PM

Some more interesting results when I look at UnexpectedSuccess

ExitDuringStep improved significantly (i386-gcc was the only one with failures and now it's passing 100%. You should remote the XFAILs from all configs)

6/50 failures->0/50 failures ExitDuringStep.ExitDuringStepTestCase.test_step_in_with_dwarf i386-gcc
19/50 failures -> 0/50 failures ExitDuringStep.ExitDuringStepTestCase.test_step_over_with_dwarf i386-gcc

PrintStackTraces.ThreadsStackTracesTestCase.test_stack_traces is only ever failing on i386 about 50% of the time, never on x86_64. Consider removing x86_64 XFAIL again.

This test went from 1/300 failures to 0/300 failures: (not significant)

CallWithTimeout.ExprCommandWithTimeoutsTestCase.test_with_dwarf
CreateAfterAttachTestCase.test_create_after_attach_with_dwarf_and_fork

This test increased from 0/300 failures to 1/300 failures: (not significant)

GdbRemoteAuxvSupport.TestGdbRemoteAuxvSupport.test_auxv_chunked_reads_work_llgs_dwarf

chaoren accepted this revision.May 4 2015, 12:49 PM
chaoren edited edge metadata.

LGTM. Some typos:

source/Plugins/Process/Linux/NativeProcessLinux.cpp
2715 ↗(On Diff #24629)
// we they are

The typo is still here.

source/Plugins/Process/Linux/NativeProcessLinux.h
412 ↗(On Diff #24734)

Remove "either".

This revision was automatically updated to reflect the committed changes.