This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] GDB checkpoint can't/shouldn't be possible with multiple threads on Linux
- From: Kevin Pouget <kevin dot pouget at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 12 Apr 2011 03:44:14 -0400
- Subject: [PATCH] GDB checkpoint can't/shouldn't be possible with multiple threads on Linux
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)