From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28375 invoked by alias); 12 Apr 2011 07:44:40 -0000 Received: (qmail 28367 invoked by uid 22791); 12 Apr 2011 07:44:39 -0000 X-SWARE-Spam-Status: No, hits=1.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KAM_STOCKTIP,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Apr 2011 07:44:35 +0000 Received: by vxk20 with SMTP id 20so6121234vxk.0 for ; Tue, 12 Apr 2011 00:44:34 -0700 (PDT) Received: by 10.52.73.130 with SMTP id l2mr4091163vdv.14.1302594274709; Tue, 12 Apr 2011 00:44:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.175.197 with HTTP; Tue, 12 Apr 2011 00:44:14 -0700 (PDT) From: Kevin Pouget Date: Tue, 12 Apr 2011 07:44:00 -0000 Message-ID: Subject: [PATCH] GDB checkpoint can't/shouldn't be possible with multiple threads on Linux To: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00158.txt.bz2 Hello, as I reported in http://sourceware.org/bugzilla/show_bug.cgi?id=12628 and discussed in http://sourceware.org/ml/gdb/2011-04/msg00018.html, GDB can't handle properly the checkpointing of an application currently running several threads without a dedicated support. This patch updates the thread-list and check the thread count before doing the actual checkpoint. (does such a patch require a test case?) Cordially, Kevin ----------- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 880781a..611aa7e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2011-04-12 Kevin Pouget + + PR threads/12628 + * linux-fork.c (checkpoint_command): Disallow checkpointing of + processes with multiple threads. + 2011-03-29 Kevin Pouget Allow Python notification of new object-file loadings. diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 7f654af..c137604 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -628,6 +628,11 @@ checkpoint_command (char *args, int from_tty) pid_t retpid; struct cleanup *old_chain; + /* Ensure that the inferior is not multithreaded. */ + update_thread_list () ; + if (thread_count () > 1) + error (_("checkpoint: can't checkpoint multiple threads.")) ; + /* Make the inferior fork, record its (and gdb's) state. */ if (lookup_minimal_symbol ("fork", NULL, NULL) != NULL)