From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [RFC] persistence of schedlock mode
Date: Wed, 12 May 2010 18:08:00 -0000 [thread overview]
Message-ID: <4BEAEEB0.5040202@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 487 bytes --]
Bug 11580 points out a problem related to persistence of the
scheduler locking mode. If you set the mode to "on" (which
means that only one thread can run), and then kill and restart
your program, the mode persists and your program may deadlock.
I don't think this is a problem for mode "step", and it could
be argued that mode "on" is "use at your own risk". However
I've been thinking about how to resolve it, and this simple
but intrusive patch is what I come up with.
Comments?
[-- Attachment #2: schedlock.txt --]
[-- Type: text/plain, Size: 1236 bytes --]
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.438
diff -u -p -r1.438 infrun.c
--- infrun.c 6 May 2010 19:14:08 -0000 1.438
+++ infrun.c 12 May 2010 17:37:09 -0000
@@ -1416,6 +1416,18 @@ set_schedlock_func (char *args, int from
}
}
+/* reset_schedlock -- public */
+
+void
+reset_schedlock ()
+{
+ if (scheduler_mode == schedlock_on)
+ {
+ warning ("Resetting scheduler-lock mode to 'off'");
+ scheduler_mode = schedlock_off;
+ }
+}
+
/* True if execution commands resume all threads of all processes by
default; otherwise, resume only threads of the current inferior
process. */
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.250
diff -u -p -r1.250 target.c
--- target.c 6 May 2010 22:29:49 -0000 1.250
+++ target.c 12 May 2010 17:37:09 -0000
@@ -2231,6 +2231,10 @@ void
target_mourn_inferior (void)
{
struct target_ops *t;
+
+ /* Clear schedlock in infrun.c */
+ reset_schedlock ();
+
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_mourn_inferior != NULL)
next reply other threads:[~2010-05-12 18:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-12 18:08 Michael Snyder [this message]
2010-05-12 19:25 ` Pedro Alves
2010-05-12 19:49 ` Mark Kettenis
2010-05-17 10:33 ` Pierre Muller
2010-05-17 15:29 ` Joel Brobecker
2010-05-17 17:34 ` Michael Snyder
2010-05-17 13:20 ` Nathan Froyd
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=4BEAEEB0.5040202@vmware.com \
--to=msnyder@vmware.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