|
From: Petar J. <pe...@so...> - 2017-11-13 12:14:27
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=286d05eea0fc1059492bec127d4121770902c98c commit 286d05eea0fc1059492bec127d4121770902c98c Author: Petar Jovanovic <mip...@gm...> Date: Mon Nov 13 13:12:25 2017 +0100 synchronize access to vgdb_interrupted_tid Delay writing to the global vgdb_interrupted_tid until all the threads are in interruptible state. This ensures that valgrind_wait() will see correct value. This solves occasional failures of gdbserver_tests/hgtls test. Diff: --- coregrind/m_gdbserver/m_gdbserver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c index 648d543..24716ad 100644 --- a/coregrind/m_gdbserver/m_gdbserver.c +++ b/coregrind/m_gdbserver/m_gdbserver.c @@ -876,7 +876,7 @@ void VG_(invoke_gdbserver) ( int check ) gdbserver. Otherwise, we let the valgrind scheduler invoke gdbserver at the next poll. This poll will be made very soon thanks to a call to VG_(force_vgdb_poll). */ - int n_tid; + int n_tid, vgdb_interrupted_tid_local = 0; vg_assert (check == 0x8BADF00D); @@ -894,7 +894,8 @@ void VG_(invoke_gdbserver) ( int check ) /* interruptible states. */ case VgTs_WaitSys: case VgTs_Yielding: - if (vgdb_interrupted_tid == 0) vgdb_interrupted_tid = n_tid; + if (vgdb_interrupted_tid_local == 0) + vgdb_interrupted_tid_local = n_tid; break; case VgTs_Empty: @@ -912,6 +913,8 @@ void VG_(invoke_gdbserver) ( int check ) } } + vgdb_interrupted_tid = vgdb_interrupted_tid_local; + /* .... till here. From here onwards, function calls are ok: it is safe to call valgrind core functions: all threads are blocked in |