public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug threads/12628] New: GDB checkpoint can't/shouldn't be possible with multiple threads on Linux
@ 2011-03-31 14:08 kevin.pouget at gmail dot com
2011-04-21 11:05 ` [Bug threads/12628] " kevin.pouget at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: kevin.pouget at gmail dot com @ 2011-03-31 14:08 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12628
Summary: GDB checkpoint can't/shouldn't be possible with
multiple threads on Linux
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: threads
AssignedTo: unassigned@sourceware.org
ReportedBy: kevin.pouget@gmail.com
According to the man page of `fork':
A process shall be created with a single thread. If a multi-threaded process
calls fork(), the new process shall contain a replica of the calling thread and
its entire address space, possibly including the states of mutexes and other
resources. Consequently, to avoid errors, the child process may only execute
async-signal-safe operations until such time as one of the exec functions is
called. Fork handlers may be established by means of the pthread_atfork()
function in order to maintain application invariants across fork() calls.
Below is a patch which simply forbids to create a checkpoint when GDB knows
that there are multiple threads in the debuggee.
The Man page obviously assumes a kernel-based thread library, so does my patch
(user-level thread libraries should fork correctly), but do we want to handle
this situation? (linux-thread-db.c is -- at least was, a few years ago -- tight
to GlibC's Pthread implementation, so it might be fine to continue on this way.
Cordially,
Kevin
---
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 7f654af..3eddea4 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)
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug threads/12628] GDB checkpoint can't/shouldn't be possible with multiple threads on Linux
2011-03-31 14:08 [Bug threads/12628] New: GDB checkpoint can't/shouldn't be possible with multiple threads on Linux kevin.pouget at gmail dot com
@ 2011-04-21 11:05 ` kevin.pouget at gmail dot com
2011-09-15 14:38 ` cvs-commit at gcc dot gnu.org
2011-10-05 18:02 ` kevin.pouget at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: kevin.pouget at gmail dot com @ 2011-04-21 11:05 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12628
Kevin Pouget <kevin.pouget at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at sourceware |kevin.pouget at gmail dot
|dot org |com
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug threads/12628] GDB checkpoint can't/shouldn't be possible with multiple threads on Linux
2011-03-31 14:08 [Bug threads/12628] New: GDB checkpoint can't/shouldn't be possible with multiple threads on Linux kevin.pouget at gmail dot com
2011-04-21 11:05 ` [Bug threads/12628] " kevin.pouget at gmail dot com
@ 2011-09-15 14:38 ` cvs-commit at gcc dot gnu.org
2011-10-05 18:02 ` kevin.pouget at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2011-09-15 14:38 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12628
--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2011-09-15 12:47:14 UTC ---
CVSROOT: /cvs/src
Module name: src
Changes by: kpouget@sourceware.org 2011-09-15 12:47:07
Modified files:
gdb : ChangeLog linux-fork.c
Log message:
2011-09-15 Kevin Pouget <kevin.pouget@st.com>
PR threads/12628
* linux-fork.c (checkpoint_command): Disallow checkpointing of
processes with multiple threads.
(inf_has_multiple_thread_cb): New function.
(inf_has_multiple_threads): New function.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13333&r2=1.13334
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/linux-fork.c.diff?cvsroot=src&r1=1.38&r2=1.39
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug threads/12628] GDB checkpoint can't/shouldn't be possible with multiple threads on Linux
2011-03-31 14:08 [Bug threads/12628] New: GDB checkpoint can't/shouldn't be possible with multiple threads on Linux kevin.pouget at gmail dot com
2011-04-21 11:05 ` [Bug threads/12628] " kevin.pouget at gmail dot com
2011-09-15 14:38 ` cvs-commit at gcc dot gnu.org
@ 2011-10-05 18:02 ` kevin.pouget at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: kevin.pouget at gmail dot com @ 2011-10-05 18:02 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=12628
Kevin Pouget <kevin.pouget at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #3 from Kevin Pouget <kevin.pouget at gmail dot com> 2011-10-05 18:02:36 UTC ---
fixed
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-05 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-31 14:08 [Bug threads/12628] New: GDB checkpoint can't/shouldn't be possible with multiple threads on Linux kevin.pouget at gmail dot com
2011-04-21 11:05 ` [Bug threads/12628] " kevin.pouget at gmail dot com
2011-09-15 14:38 ` cvs-commit at gcc dot gnu.org
2011-10-05 18:02 ` kevin.pouget at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).