summaryrefslogtreecommitdiff
path: root/share/doc/gdb/All_002dStop-Mode.html
diff options
context:
space:
mode:
Diffstat (limited to 'share/doc/gdb/All_002dStop-Mode.html')
-rw-r--r--share/doc/gdb/All_002dStop-Mode.html195
1 files changed, 195 insertions, 0 deletions
diff --git a/share/doc/gdb/All_002dStop-Mode.html b/share/doc/gdb/All_002dStop-Mode.html
new file mode 100644
index 0000000..1e595c2
--- /dev/null
+++ b/share/doc/gdb/All_002dStop-Mode.html
@@ -0,0 +1,195 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!-- Copyright (C) 1988-2023 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being "Free Software" and "Free Software Needs
+Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
+and with the Back-Cover Texts as in (a) below.
+
+(a) The FSF's Back-Cover Text is: "You are free to copy and modify
+this GNU Manual. Buying copies from GNU Press supports the FSF in
+developing GNU and promoting software freedom." -->
+<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
+<head>
+<title>Debugging with GDB: All-Stop Mode</title>
+
+<meta name="description" content="Debugging with GDB: All-Stop Mode">
+<meta name="keywords" content="Debugging with GDB: All-Stop Mode">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="Generator" content="makeinfo">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<link href="index.html#Top" rel="start" title="Top">
+<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
+<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
+<link href="Thread-Stops.html#Thread-Stops" rel="up" title="Thread Stops">
+<link href="Non_002dStop-Mode.html#Non_002dStop-Mode" rel="next" title="Non-Stop Mode">
+<link href="Thread-Stops.html#Thread-Stops" rel="previous" title="Thread Stops">
+<style type="text/css">
+<!--
+a.summary-letter {text-decoration: none}
+blockquote.smallquotation {font-size: smaller}
+div.display {margin-left: 3.2em}
+div.example {margin-left: 3.2em}
+div.indentedblock {margin-left: 3.2em}
+div.lisp {margin-left: 3.2em}
+div.smalldisplay {margin-left: 3.2em}
+div.smallexample {margin-left: 3.2em}
+div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
+div.smalllisp {margin-left: 3.2em}
+kbd {font-style:oblique}
+pre.display {font-family: inherit}
+pre.format {font-family: inherit}
+pre.menu-comment {font-family: serif}
+pre.menu-preformatted {font-family: serif}
+pre.smalldisplay {font-family: inherit; font-size: smaller}
+pre.smallexample {font-size: smaller}
+pre.smallformat {font-family: inherit; font-size: smaller}
+pre.smalllisp {font-size: smaller}
+span.nocodebreak {white-space:nowrap}
+span.nolinebreak {white-space:nowrap}
+span.roman {font-family:serif; font-weight:normal}
+span.sansserif {font-family:sans-serif; font-weight:normal}
+ul.no-bullet {list-style: none}
+-->
+</style>
+
+
+</head>
+
+<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
+<a name="All_002dStop-Mode"></a>
+<div class="header">
+<p>
+Next: <a href="Non_002dStop-Mode.html#Non_002dStop-Mode" accesskey="n" rel="next">Non-Stop Mode</a>, Up: <a href="Thread-Stops.html#Thread-Stops" accesskey="u" rel="up">Thread Stops</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
+</div>
+<hr>
+<a name="All_002dStop-Mode-1"></a>
+<h4 class="subsection">5.5.1 All-Stop Mode</h4>
+
+<a name="index-all_002dstop-mode"></a>
+
+<p>In all-stop mode, whenever your program stops under <small>GDB</small> for any reason,
+<em>all</em> threads of execution stop, not just the current thread. This
+allows you to examine the overall state of the program, including
+switching between threads, without worrying that things may change
+underfoot.
+</p>
+<p>Conversely, whenever you restart the program, <em>all</em> threads start
+executing. <em>This is true even when single-stepping</em> with commands
+like <code>step</code> or <code>next</code>.
+</p>
+<p>In particular, <small>GDB</small> cannot single-step all threads in lockstep.
+Since thread scheduling is up to your debugging target&rsquo;s operating
+system (not controlled by <small>GDB</small>), other threads may
+execute more than one statement while the current thread completes a
+single step. Moreover, in general other threads stop in the middle of a
+statement, rather than at a clean statement boundary, when the program
+stops.
+</p>
+<p>You might even find your program stopped in another thread after
+continuing or even single-stepping. This happens whenever some other
+thread runs into a breakpoint, a signal, or an exception before the
+first thread completes whatever you requested.
+</p>
+<a name="index-automatic-thread-selection"></a>
+<a name="index-switching-threads-automatically"></a>
+<a name="index-threads_002c-automatic-switching"></a>
+<p>Whenever <small>GDB</small> stops your program, due to a breakpoint or a
+signal, it automatically selects the thread where that breakpoint or
+signal happened. <small>GDB</small> alerts you to the context switch with a
+message such as &lsquo;<samp>[Switching to Thread <var>n</var>]</samp>&rsquo; to identify the
+thread.
+</p>
+<p>On some OSes, you can modify <small>GDB</small>&rsquo;s default behavior by
+locking the OS scheduler to allow only a single thread to run.
+</p>
+<dl compact="compact">
+<dt><code>set scheduler-locking <var>mode</var></code></dt>
+<dd><a name="index-scheduler-locking-mode"></a>
+<a name="index-lock-scheduler"></a>
+<p>Set the scheduler locking mode. It applies to normal execution,
+record mode, and replay mode. <var>mode</var> can be one of
+the following:
+</p>
+<dl compact="compact">
+<dt><code>off</code></dt>
+<dd><p>There is no locking and any thread may run at any time.
+</p>
+</dd>
+<dt><code>on</code></dt>
+<dd><p>Only the current thread may run when the inferior is resumed.
+</p>
+</dd>
+<dt><code>step</code></dt>
+<dd><p>Behaves like <code>on</code> when stepping, and <code>off</code> otherwise.
+Threads other than the current never get a chance to run when you
+step, and they are completely free to run when you use commands like
+&lsquo;<samp>continue</samp>&rsquo;, &lsquo;<samp>until</samp>&rsquo;, or &lsquo;<samp>finish</samp>&rsquo;.
+</p>
+<p>This mode optimizes for single-stepping; it prevents other threads
+from preempting the current thread while you are stepping, so that the
+focus of debugging does not change unexpectedly. However, unless
+another thread hits a breakpoint during its timeslice, <small>GDB</small>
+does not change the current thread away from the thread that you are
+debugging.
+</p>
+</dd>
+<dt><code>replay</code></dt>
+<dd><p>Behaves like <code>on</code> in replay mode, and <code>off</code> in either record
+mode or during normal execution. This is the default mode.
+</p></dd>
+</dl>
+
+</dd>
+<dt><code>show scheduler-locking</code></dt>
+<dd><p>Display the current scheduler locking mode.
+</p></dd>
+</dl>
+
+<a name="index-resume-threads-of-multiple-processes-simultaneously"></a>
+<p>By default, when you issue one of the execution commands such as
+<code>continue</code>, <code>next</code> or <code>step</code>, <small>GDB</small> allows only
+threads of the current inferior to run. For example, if <small>GDB</small>
+is attached to two inferiors, each with two threads, the
+<code>continue</code> command resumes only the two threads of the current
+inferior. This is useful, for example, when you debug a program that
+forks and you want to hold the parent stopped (so that, for instance,
+it doesn&rsquo;t run to exit), while you debug the child. In other
+situations, you may not be interested in inspecting the current state
+of any of the processes <small>GDB</small> is attached to, and you may want
+to resume them all until some breakpoint is hit. In the latter case,
+you can instruct <small>GDB</small> to allow all threads of all the
+inferiors to run with the <code>set&nbsp;<span class="nolinebreak">schedule-multiple</span></code><!-- /@w --> command.
+</p>
+<dl compact="compact">
+<dd><a name="index-set-schedule_002dmultiple"></a>
+</dd>
+<dt><code>set schedule-multiple</code></dt>
+<dd><p>Set the mode for allowing threads of multiple processes to be resumed
+when an execution command is issued. When <code>on</code>, all threads of
+all processes are allowed to run. When <code>off</code>, only the threads
+of the current process are resumed. The default is <code>off</code>. The
+<code>scheduler-locking</code> mode takes precedence when set to <code>on</code>,
+or while you are stepping and set to <code>step</code>.
+</p>
+</dd>
+<dt><code>show schedule-multiple</code></dt>
+<dd><p>Display the current mode for resuming the execution of threads of
+multiple processes.
+</p></dd>
+</dl>
+
+<hr>
+<div class="header">
+<p>
+Next: <a href="Non_002dStop-Mode.html#Non_002dStop-Mode" accesskey="n" rel="next">Non-Stop Mode</a>, Up: <a href="Thread-Stops.html#Thread-Stops" accesskey="u" rel="up">Thread Stops</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
+</div>
+
+
+
+</body>
+</html>