GNU Binutils with patches for OS216
修订版 | 3aa5cfa0d1cdbbd839884302535da28ca8c8b00d (tree) |
---|---|
时间 | 2016-09-01 02:46:22 |
作者 | Antoine Tremblay <antoine.tremblay@eric...> |
Commiter | Antoine Tremblay |
Fix lwp_suspend/unsuspend imbalance in linux_wait_1
This patch fixes imbalanced lwp_suspend/unsuspend calls caused by the
premature choosing of another event for fairness.
select_event_lwp would switch the event before a call to
unsuspend_all_lwps, thus it would be called with the wrong event.
This caused an assertion failure: unsuspend LWP xx, suspended=-1 when
testing gdb.threads/non-stop-fair-events.exp with ARM range stepping in
GDBServer.
This patch moves the switch of event after the unsuspend/unstop calls.
No regressions, tested on ubuntu 14.04 ARMv7 and x86.
With gdbserver-native.
gdb/gdbserver/ChangeLog:
* linux-low.c (linux_wait_1): Move event switch after unsuspend_lwps.
@@ -1,3 +1,7 @@ | ||
1 | +2016-08-31 Antoine Tremblay <antoine.tremblay@ericsson.com> | |
2 | + | |
3 | + * linux-low.c (linux_wait_1): Move event switch after unsuspend_lwps. | |
4 | + | |
1 | 5 | 2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org> |
2 | 6 | |
3 | 7 | PR server/20491 |
@@ -3771,24 +3771,6 @@ linux_wait_1 (ptid_t ptid, | ||
3771 | 3771 | if (!non_stop) |
3772 | 3772 | stop_all_lwps (0, NULL); |
3773 | 3773 | |
3774 | - /* If we're not waiting for a specific LWP, choose an event LWP | |
3775 | - from among those that have had events. Giving equal priority | |
3776 | - to all LWPs that have had events helps prevent | |
3777 | - starvation. */ | |
3778 | - if (ptid_equal (ptid, minus_one_ptid)) | |
3779 | - { | |
3780 | - event_child->status_pending_p = 1; | |
3781 | - event_child->status_pending = w; | |
3782 | - | |
3783 | - select_event_lwp (&event_child); | |
3784 | - | |
3785 | - /* current_thread and event_child must stay in sync. */ | |
3786 | - current_thread = get_lwp_thread (event_child); | |
3787 | - | |
3788 | - event_child->status_pending_p = 0; | |
3789 | - w = event_child->status_pending; | |
3790 | - } | |
3791 | - | |
3792 | 3774 | if (step_over_finished) |
3793 | 3775 | { |
3794 | 3776 | if (!non_stop) |
@@ -3813,6 +3795,25 @@ linux_wait_1 (ptid_t ptid, | ||
3813 | 3795 | } |
3814 | 3796 | } |
3815 | 3797 | |
3798 | + /* If we're not waiting for a specific LWP, choose an event LWP | |
3799 | + from among those that have had events. Giving equal priority | |
3800 | + to all LWPs that have had events helps prevent | |
3801 | + starvation. */ | |
3802 | + if (ptid_equal (ptid, minus_one_ptid)) | |
3803 | + { | |
3804 | + event_child->status_pending_p = 1; | |
3805 | + event_child->status_pending = w; | |
3806 | + | |
3807 | + select_event_lwp (&event_child); | |
3808 | + | |
3809 | + /* current_thread and event_child must stay in sync. */ | |
3810 | + current_thread = get_lwp_thread (event_child); | |
3811 | + | |
3812 | + event_child->status_pending_p = 0; | |
3813 | + w = event_child->status_pending; | |
3814 | + } | |
3815 | + | |
3816 | + | |
3816 | 3817 | /* Stabilize threads (move out of jump pads). */ |
3817 | 3818 | if (!non_stop) |
3818 | 3819 | stabilize_threads (); |