Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Pouget <kevin.pouget@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] GDB checkpoint can't/shouldn't be possible with multiple threads on Linux
Date: Tue, 12 Apr 2011 07:44:00 -0000	[thread overview]
Message-ID: <BANLkTi=pTUVx5iHkb0-0oZyKJHNbALY2SA@mail.gmail.com> (raw)

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 <kevin.pouget@st.com>
+
+	PR threads/12628
+	* linux-fork.c (checkpoint_command): Disallow checkpointing of
+	processes with multiple threads.
+
 2011-03-29 Kevin Pouget <kevin.pouget@st.com>

 	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)


             reply	other threads:[~2011-04-12  7:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12  7:44 Kevin Pouget [this message]
2011-04-12 10:59 ` Pedro Alves
2011-04-12 11:55   ` Kevin Pouget
2011-04-12 12:55     ` Pedro Alves
2011-04-12 13:28       ` Kevin Pouget
2011-04-12 13:36         ` Pedro Alves
2011-04-12 13:42         ` Pedro Alves
2011-04-12 13:55           ` Kevin Pouget
2011-08-31 12:45             ` Kevin Pouget
2011-09-06 14:42               ` Pedro Alves
2011-09-15 13:32                 ` Kevin Pouget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=pTUVx5iHkb0-0oZyKJHNbALY2SA@mail.gmail.com' \
    --to=kevin.pouget@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox