Mark Wielaard bd144c
commit 59af5db9c15d8ea03c1521736fb1f107d66bce08
Mark Wielaard bd144c
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Mark Wielaard bd144c
Date:   Sun Jun 25 20:25:50 2017 +0000
Mark Wielaard bd144c
Mark Wielaard bd144c
    After fork, vgdb activity is polled according to the nr of bbs done :
Mark Wielaard bd144c
    once the nr of bbs done reaches the next vgdb poll, a check for vgdb
Mark Wielaard bd144c
    activity is done.
Mark Wielaard bd144c
    This might lead to the activation of gdbserver after fork.
Mark Wielaard bd144c
    Such poll is however not expected, unless the children is
Mark Wielaard bd144c
    to be trace.
Mark Wielaard bd144c
    This spurious poll in the forked child can cause failures
Mark Wielaard bd144c
    depending on the nr of bbs done before the fork, and the
Mark Wielaard bd144c
    nr of bbs done between the fork and the exec.
Mark Wielaard bd144c
    
Mark Wielaard bd144c
    => disable vgdb poll in the child in the cleanup after fork
Mark Wielaard bd144c
    in the child, unless the children have to be traced.
Mark Wielaard bd144c
    
Mark Wielaard bd144c
    
Mark Wielaard bd144c
    
Mark Wielaard bd144c
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16454 a5019735-40e9-0310-863c-91ae7b9d1cf9
Mark Wielaard bd144c
Mark Wielaard bd144c
diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c
Mark Wielaard bd144c
index 87fbce2..648d543 100644
Mark Wielaard bd144c
--- a/coregrind/m_gdbserver/m_gdbserver.c
Mark Wielaard bd144c
+++ b/coregrind/m_gdbserver/m_gdbserver.c
Mark Wielaard bd144c
@@ -646,6 +646,10 @@ static void gdbserver_cleanup_in_child_after_fork(ThreadId me)
Mark Wielaard bd144c
    
Mark Wielaard bd144c
    if (VG_(clo_trace_children)) {
Mark Wielaard bd144c
       VG_(gdbserver_prerun_action) (me);
Mark Wielaard bd144c
+   } else {
Mark Wielaard bd144c
+      /* After fork, if we do not trace the children, disable vgdb
Mark Wielaard bd144c
+         poll to avoid gdbserver being called unexpectedly. */
Mark Wielaard bd144c
+      VG_(disable_vgdb_poll) ();
Mark Wielaard bd144c
    }
Mark Wielaard bd144c
 }
Mark Wielaard bd144c