• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版3aa5cfa0d1cdbbd839884302535da28ca8c8b00d (tree)
时间2016-09-01 02:46:22
作者Antoine Tremblay <antoine.tremblay@eric...>
CommiterAntoine Tremblay

Log Message

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.

更改概述

差异

--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -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+
15 2016-08-25 Adhemerval Zanella <adhemerval.zanella@linaro.org>
26
37 PR server/20491
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -3771,24 +3771,6 @@ linux_wait_1 (ptid_t ptid,
37713771 if (!non_stop)
37723772 stop_all_lwps (0, NULL);
37733773
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-
37923774 if (step_over_finished)
37933775 {
37943776 if (!non_stop)
@@ -3813,6 +3795,25 @@ linux_wait_1 (ptid_t ptid,
38133795 }
38143796 }
38153797
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+
38163817 /* Stabilize threads (move out of jump pads). */
38173818 if (!non_stop)
38183819 stabilize_threads ();