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