1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<!-- Copyright (C) 1988-2021 Free Software Foundation, Inc.
4
5Permission is granted to copy, distribute and/or modify this document
6under the terms of the GNU Free Documentation License, Version 1.3 or
7any later version published by the Free Software Foundation; with the
8Invariant Sections being "Free Software" and "Free Software Needs
9Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
10and with the Back-Cover Texts as in (a) below.
11
12(a) The FSF's Back-Cover Text is: "You are free to copy and modify
13this GNU Manual.  Buying copies from GNU Press supports the FSF in
14developing GNU and promoting software freedom." -->
15<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
16<head>
17<title>Debugging with GDB: Threads</title>
18
19<meta name="description" content="Debugging with GDB: Threads">
20<meta name="keywords" content="Debugging with GDB: Threads">
21<meta name="resource-type" content="document">
22<meta name="distribution" content="global">
23<meta name="Generator" content="makeinfo">
24<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
25<link href="index.html#Top" rel="start" title="Top">
26<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
27<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
28<link href="Running.html#Running" rel="up" title="Running">
29<link href="Forks.html#Forks" rel="next" title="Forks">
30<link href="Inferiors-Connections-and-Programs.html#Inferiors-Connections-and-Programs" rel="previous" title="Inferiors Connections and Programs">
31<style type="text/css">
32<!--
33a.summary-letter {text-decoration: none}
34blockquote.smallquotation {font-size: smaller}
35div.display {margin-left: 3.2em}
36div.example {margin-left: 3.2em}
37div.indentedblock {margin-left: 3.2em}
38div.lisp {margin-left: 3.2em}
39div.smalldisplay {margin-left: 3.2em}
40div.smallexample {margin-left: 3.2em}
41div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
42div.smalllisp {margin-left: 3.2em}
43kbd {font-style:oblique}
44pre.display {font-family: inherit}
45pre.format {font-family: inherit}
46pre.menu-comment {font-family: serif}
47pre.menu-preformatted {font-family: serif}
48pre.smalldisplay {font-family: inherit; font-size: smaller}
49pre.smallexample {font-size: smaller}
50pre.smallformat {font-family: inherit; font-size: smaller}
51pre.smalllisp {font-size: smaller}
52span.nocodebreak {white-space:nowrap}
53span.nolinebreak {white-space:nowrap}
54span.roman {font-family:serif; font-weight:normal}
55span.sansserif {font-family:sans-serif; font-weight:normal}
56ul.no-bullet {list-style: none}
57-->
58</style>
59
60
61</head>
62
63<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
64<a name="Threads"></a>
65<div class="header">
66<p>
67Next: <a href="Forks.html#Forks" accesskey="n" rel="next">Forks</a>, Previous: <a href="Inferiors-Connections-and-Programs.html#Inferiors-Connections-and-Programs" accesskey="p" rel="previous">Inferiors Connections and Programs</a>, Up: <a href="Running.html#Running" accesskey="u" rel="up">Running</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>
68</div>
69<hr>
70<a name="Debugging-Programs-with-Multiple-Threads"></a>
71<h3 class="section">4.10 Debugging Programs with Multiple Threads</h3>
72
73<a name="index-threads-of-execution"></a>
74<a name="index-multiple-threads"></a>
75<a name="index-switching-threads"></a>
76<p>In some operating systems, such as GNU/Linux and Solaris, a single program
77may have more than one <em>thread</em> of execution.  The precise semantics
78of threads differ from one operating system to another, but in general
79the threads of a single program are akin to multiple processes&mdash;except
80that they share one address space (that is, they can all examine and
81modify the same variables).  On the other hand, each thread has its own
82registers and execution stack, and perhaps private memory.
83</p>
84<p><small>GDB</small> provides these facilities for debugging multi-thread
85programs:
86</p>
87<ul>
88<li> automatic notification of new threads
89</li><li> &lsquo;<samp>thread <var>thread-id</var></samp>&rsquo;, a command to switch among threads
90</li><li> &lsquo;<samp>info threads</samp>&rsquo;, a command to inquire about existing threads
91</li><li> &lsquo;<samp>thread apply [<var>thread-id-list</var> | all] <var>args</var></samp>&rsquo;,
92a command to apply a command to a list of threads
93</li><li> thread-specific breakpoints
94</li><li> &lsquo;<samp>set print thread-events</samp>&rsquo;, which controls printing of
95messages on thread start and exit.
96</li><li> &lsquo;<samp>set libthread-db-search-path <var>path</var></samp>&rsquo;, which lets
97the user specify which <code>libthread_db</code> to use if the default choice
98isn&rsquo;t compatible with the program.
99</li></ul>
100
101<a name="index-focus-of-debugging"></a>
102<a name="index-current-thread"></a>
103<p>The <small>GDB</small> thread debugging facility allows you to observe all
104threads while your program runs&mdash;but whenever <small>GDB</small> takes
105control, one thread in particular is always the focus of debugging.
106This thread is called the <em>current thread</em>.  Debugging commands show
107program information from the perspective of the current thread.
108</p>
109<a name="index-New-systag-message"></a>
110<a name="index-thread-identifier-_0028system_0029"></a>
111<p>Whenever <small>GDB</small> detects a new thread in your program, it displays
112the target system&rsquo;s identification for the thread with a message in the
113form &lsquo;<samp>[New <var>systag</var>]</samp>&rsquo;, where <var>systag</var> is a thread identifier
114whose form varies depending on the particular system.  For example, on
115<small>GNU</small>/Linux, you might see
116</p>
117<div class="smallexample">
118<pre class="smallexample">[New Thread 0x41e02940 (LWP 25582)]
119</pre></div>
120
121<p>when <small>GDB</small> notices a new thread.  In contrast, on other systems,
122the <var>systag</var> is simply something like &lsquo;<samp>process 368</samp>&rsquo;, with no
123further qualifier.
124</p>
125
126<a name="thread-numbers"></a><a name="index-thread-number_002c-per-inferior"></a>
127<a name="index-thread-identifier-_0028GDB_0029"></a>
128<p>For debugging purposes, <small>GDB</small> associates its own thread number
129&mdash;always a single integer&mdash;with each thread of an inferior.  This
130number is unique between all threads of an inferior, but not unique
131between threads of different inferiors.
132</p>
133<a name="index-qualified-thread-ID"></a>
134<p>You can refer to a given thread in an inferior using the qualified
135<var>inferior-num</var>.<var>thread-num</var> syntax, also known as
136<em>qualified thread ID</em>, with <var>inferior-num</var> being the inferior
137number and <var>thread-num</var> being the thread number of the given
138inferior.  For example, thread <code>2.3</code> refers to thread number 3 of
139inferior 2.  If you omit <var>inferior-num</var> (e.g., <code>thread 3</code>),
140then <small>GDB</small> infers you&rsquo;re referring to a thread of the current
141inferior.
142</p>
143<p>Until you create a second inferior, <small>GDB</small> does not show the
144<var>inferior-num</var> part of thread IDs, even though you can always use
145the full <var>inferior-num</var>.<var>thread-num</var> form to refer to threads
146of inferior 1, the initial inferior.
147</p>
148<a name="thread-ID-lists"></a><a name="index-thread-ID-lists"></a>
149<p>Some commands accept a space-separated <em>thread ID list</em> as
150argument.  A list element can be:
151</p>
152<ol>
153<li> A thread ID as shown in the first field of the &lsquo;<samp>info threads</samp>&rsquo;
154display, with or without an inferior qualifier.  E.g., &lsquo;<samp>2.1</samp>&rsquo; or
155&lsquo;<samp>1</samp>&rsquo;.
156
157</li><li> A range of thread numbers, again with or without an inferior
158qualifier, as in <var>inf</var>.<var>thr1</var>-<var>thr2</var> or
159<var>thr1</var>-<var>thr2</var>.  E.g., &lsquo;<samp>1.2-4</samp>&rsquo; or &lsquo;<samp>2-4</samp>&rsquo;.
160
161</li><li> All threads of an inferior, specified with a star wildcard, with or
162without an inferior qualifier, as in <var>inf</var>.<code>*</code> (e.g.,
163&lsquo;<samp>1.*</samp>&rsquo;) or <code>*</code>.  The former refers to all threads of the
164given inferior, and the latter form without an inferior qualifier
165refers to all threads of the current inferior.
166
167</li></ol>
168
169<p>For example, if the current inferior is 1, and inferior 7 has one
170thread with ID 7.1, the thread list &lsquo;<samp>1 2-3 4.5 6.7-9 7.*</samp>&rsquo;
171includes threads 1 to 3 of inferior 1, thread 5 of inferior 4, threads
1727 to 9 of inferior 6 and all threads of inferior 7.  That is, in
173expanded qualified form, the same as &lsquo;<samp>1.1 1.2 1.3 4.5 6.7 6.8 6.9
1747.1</samp>&rsquo;.
175</p>
176
177<a name="global-thread-numbers"></a><a name="index-global-thread-number"></a>
178<a name="index-global-thread-identifier-_0028GDB_0029"></a>
179<p>In addition to a <em>per-inferior</em> number, each thread is also
180assigned a unique <em>global</em> number, also known as <em>global
181thread ID</em>, a single integer.  Unlike the thread number component of
182the thread ID, no two threads have the same global ID, even when
183you&rsquo;re debugging multiple inferiors.
184</p>
185<p>From <small>GDB</small>&rsquo;s perspective, a process always has at least one
186thread.  In other words, <small>GDB</small> assigns a thread number to the
187program&rsquo;s &ldquo;main thread&rdquo; even if the program is not multi-threaded.
188</p>
189<a name="index-_0024_005fthread_002c-convenience-variable"></a>
190<a name="index-_0024_005fgthread_002c-convenience-variable"></a>
191<p>The debugger convenience variables &lsquo;<samp>$_thread</samp>&rsquo; and
192&lsquo;<samp>$_gthread</samp>&rsquo; contain, respectively, the per-inferior thread number
193and the global thread number of the current thread.  You may find this
194useful in writing breakpoint conditional expressions, command scripts,
195and so forth.  See <a href="Convenience-Vars.html#Convenience-Vars">Convenience Variables</a>, for
196general information on convenience variables.
197</p>
198<p>If <small>GDB</small> detects the program is multi-threaded, it augments the
199usual message about stopping at a breakpoint with the ID and name of
200the thread that hit the breakpoint.
201</p>
202<div class="smallexample">
203<pre class="smallexample">Thread 2 &quot;client&quot; hit Breakpoint 1, send_message () at client.c:68
204</pre></div>
205
206<p>Likewise when the program receives a signal:
207</p>
208<div class="smallexample">
209<pre class="smallexample">Thread 1 &quot;main&quot; received signal SIGINT, Interrupt.
210</pre></div>
211
212<dl compact="compact">
213<dd><a name="index-info-threads"></a>
214</dd>
215<dt><code>info threads <span class="roman">[</span><var>thread-id-list</var><span class="roman">]</span></code></dt>
216<dd>
217<p>Display information about one or more threads.  With no arguments
218displays information about all threads.  You can specify the list of
219threads that you want to display using the thread ID list syntax
220(see <a href="#thread-ID-lists">thread ID lists</a>).
221</p>
222<p><small>GDB</small> displays for each thread (in this order):
223</p>
224<ol>
225<li> the per-inferior thread number assigned by <small>GDB</small>
226
227</li><li> the global thread number assigned by <small>GDB</small>, if the &lsquo;<samp>-gid</samp>&rsquo;
228option was specified
229
230</li><li> the target system&rsquo;s thread identifier (<var>systag</var>)
231
232</li><li> the thread&rsquo;s name, if one is known.  A thread can either be named by
233the user (see <code>thread name</code>, below), or, in some cases, by the
234program itself.
235
236</li><li> the current stack frame summary for that thread
237</li></ol>
238
239<p>An asterisk &lsquo;<samp>*</samp>&rsquo; to the left of the <small>GDB</small> thread number
240indicates the current thread.
241</p>
242<p>For example,
243</p></dd>
244</dl>
245
246<div class="smallexample">
247<pre class="smallexample">(gdb) info threads
248  Id   Target Id             Frame
249* 1    process 35 thread 13  main (argc=1, argv=0x7ffffff8)
250  2    process 35 thread 23  0x34e5 in sigpause ()
251  3    process 35 thread 27  0x34e5 in sigpause ()
252    at threadtest.c:68
253</pre></div>
254
255<p>If you&rsquo;re debugging multiple inferiors, <small>GDB</small> displays thread
256IDs using the qualified <var>inferior-num</var>.<var>thread-num</var> format.
257Otherwise, only <var>thread-num</var> is shown.
258</p>
259<p>If you specify the &lsquo;<samp>-gid</samp>&rsquo; option, <small>GDB</small> displays a column
260indicating each thread&rsquo;s global thread ID:
261</p>
262<div class="smallexample">
263<pre class="smallexample">(gdb) info threads
264  Id   GId  Target Id             Frame
265  1.1  1    process 35 thread 13  main (argc=1, argv=0x7ffffff8)
266  1.2  3    process 35 thread 23  0x34e5 in sigpause ()
267  1.3  4    process 35 thread 27  0x34e5 in sigpause ()
268* 2.1  2    process 65 thread 1   main (argc=1, argv=0x7ffffff8)
269</pre></div>
270
271<p>On Solaris, you can display more information about user threads with a
272Solaris-specific command:
273</p>
274<dl compact="compact">
275<dt><code>maint info sol-threads</code></dt>
276<dd><a name="index-maint-info-sol_002dthreads"></a>
277<a name="index-thread-info-_0028Solaris_0029"></a>
278<p>Display info on Solaris user threads.
279</p></dd>
280</dl>
281
282<dl compact="compact">
283<dd><a name="index-thread-thread_002did"></a>
284</dd>
285<dt><code>thread <var>thread-id</var></code></dt>
286<dd><p>Make thread ID <var>thread-id</var> the current thread.  The command
287argument <var>thread-id</var> is the <small>GDB</small> thread ID, as shown in
288the first field of the &lsquo;<samp>info threads</samp>&rsquo; display, with or without an
289inferior qualifier (e.g., &lsquo;<samp>2.1</samp>&rsquo; or &lsquo;<samp>1</samp>&rsquo;).
290</p>
291<p><small>GDB</small> responds by displaying the system identifier of the
292thread you selected, and its current stack frame summary:
293</p>
294<div class="smallexample">
295<pre class="smallexample">(gdb) thread 2
296[Switching to thread 2 (Thread 0xb7fdab70 (LWP 12747))]
297#0  some_function (ignore=0x0) at example.c:8
2988	    printf (&quot;hello\n&quot;);
299</pre></div>
300
301<p>As with the &lsquo;<samp>[New &hellip;]</samp>&rsquo; message, the form of the text after
302&lsquo;<samp>Switching to</samp>&rsquo; depends on your system&rsquo;s conventions for identifying
303threads.
304</p>
305<a name="thread-apply-all"></a><a name="index-thread-apply"></a>
306<a name="index-apply-command-to-several-threads"></a>
307</dd>
308<dt><code>thread apply [<var>thread-id-list</var> | all [-ascending]] [<var>flag</var>]&hellip; <var>command</var></code></dt>
309<dd><p>The <code>thread apply</code> command allows you to apply the named
310<var>command</var> to one or more threads.  Specify the threads that you
311want affected using the thread ID list syntax (see <a href="#thread-ID-lists">thread ID lists</a>), or specify <code>all</code> to apply to all threads.  To apply a
312command to all threads in descending order, type <kbd>thread apply all
313<var>command</var></kbd>.  To apply a command to all threads in ascending order,
314type <kbd>thread apply all -ascending <var>command</var></kbd>.
315</p>
316<p>The <var>flag</var> arguments control what output to produce and how to handle
317errors raised when applying <var>command</var> to a thread.  <var>flag</var>
318must start with a <code>-</code> directly followed by one letter in
319<code>qcs</code>.  If several flags are provided, they must be given
320individually, such as <code>-c -q</code>.
321</p>
322<p>By default, <small>GDB</small> displays some thread information before the
323output produced by <var>command</var>, and an error raised during the
324execution of a <var>command</var> will abort <code>thread apply</code>.  The
325following flags can be used to fine-tune this behavior:
326</p>
327<dl compact="compact">
328<dt><code>-c</code></dt>
329<dd><p>The flag <code>-c</code>, which stands for &lsquo;<samp>continue</samp>&rsquo;, causes any
330errors in <var>command</var> to be displayed, and the execution of
331<code>thread apply</code> then continues.
332</p></dd>
333<dt><code>-s</code></dt>
334<dd><p>The flag <code>-s</code>, which stands for &lsquo;<samp>silent</samp>&rsquo;, causes any errors
335or empty output produced by a <var>command</var> to be silently ignored.
336That is, the execution continues, but the thread information and errors
337are not printed.
338</p></dd>
339<dt><code>-q</code></dt>
340<dd><p>The flag <code>-q</code> (&lsquo;<samp>quiet</samp>&rsquo;) disables printing the thread
341information.
342</p></dd>
343</dl>
344
345<p>Flags <code>-c</code> and <code>-s</code> cannot be used together.
346</p>
347<a name="index-taas"></a>
348<a name="index-apply-command-to-all-threads-_0028ignoring-errors-and-empty-output_0029"></a>
349</dd>
350<dt><code>taas [<var>option</var>]&hellip; <var>command</var></code></dt>
351<dd><p>Shortcut for <code>thread apply all -s [<var>option</var>]&hellip; <var>command</var></code>.
352Applies <var>command</var> on all threads, ignoring errors and empty output.
353</p>
354<p>The <code>taas</code> command accepts the same options as the <code>thread
355apply all</code> command.  See <a href="#thread-apply-all">thread apply all</a>.
356</p>
357<a name="index-tfaas"></a>
358<a name="index-apply-a-command-to-all-frames-of-all-threads-_0028ignoring-errors-and-empty-output_0029"></a>
359</dd>
360<dt><code>tfaas [<var>option</var>]&hellip; <var>command</var></code></dt>
361<dd><p>Shortcut for <code>thread apply all -s -- frame apply all -s [<var>option</var>]&hellip; <var>command</var></code>.
362Applies <var>command</var> on all frames of all threads, ignoring errors
363and empty output.  Note that the flag <code>-s</code> is specified twice:
364The first <code>-s</code> ensures that <code>thread apply</code> only shows the thread
365information of the threads for which <code>frame apply</code> produces
366some output.  The second <code>-s</code> is needed to ensure that <code>frame
367apply</code> shows the frame information of a frame only if the
368<var>command</var> successfully produced some output.
369</p>
370<p>It can for example be used to print a local variable or a function
371argument without knowing the thread or frame where this variable or argument
372is, using:
373</p><div class="smallexample">
374<pre class="smallexample">(gdb) tfaas p some_local_var_i_do_not_remember_where_it_is
375</pre></div>
376
377<p>The <code>tfaas</code> command accepts the same options as the <code>frame
378apply</code> command.  See <a href="Frame-Apply.html#Frame-Apply">frame apply</a>.
379</p>
380<a name="index-thread-name"></a>
381<a name="index-name-a-thread"></a>
382</dd>
383<dt><code>thread name [<var>name</var>]</code></dt>
384<dd><p>This command assigns a name to the current thread.  If no argument is
385given, any existing user-specified name is removed.  The thread name
386appears in the &lsquo;<samp>info threads</samp>&rsquo; display.
387</p>
388<p>On some systems, such as <small>GNU</small>/Linux, <small>GDB</small> is able to
389determine the name of the thread as given by the OS.  On these
390systems, a name specified with &lsquo;<samp>thread name</samp>&rsquo; will override the
391system-give name, and removing the user-specified name will cause
392<small>GDB</small> to once again display the system-specified name.
393</p>
394<a name="index-thread-find"></a>
395<a name="index-search-for-a-thread"></a>
396</dd>
397<dt><code>thread find [<var>regexp</var>]</code></dt>
398<dd><p>Search for and display thread ids whose name or <var>systag</var>
399matches the supplied regular expression.
400</p>
401<p>As well as being the complement to the &lsquo;<samp>thread name</samp>&rsquo; command,
402this command also allows you to identify a thread by its target
403<var>systag</var>.  For instance, on <small>GNU</small>/Linux, the target <var>systag</var>
404is the LWP id.
405</p>
406<div class="smallexample">
407<pre class="smallexample">(GDB) thread find 26688
408Thread 4 has target id 'Thread 0x41e02940 (LWP 26688)'
409(GDB) info thread 4
410  Id   Target Id         Frame
411  4    Thread 0x41e02940 (LWP 26688) 0x00000031ca6cd372 in select ()
412</pre></div>
413
414<a name="index-set-print-thread_002devents"></a>
415<a name="index-print-messages-on-thread-start-and-exit"></a>
416</dd>
417<dt><code>set print thread-events</code></dt>
418<dt><code>set print thread-events on</code></dt>
419<dt><code>set print thread-events off</code></dt>
420<dd><p>The <code>set print thread-events</code> command allows you to enable or
421disable printing of messages when <small>GDB</small> notices that new threads have
422started or that threads have exited.  By default, these messages will
423be printed if detection of these events is supported by the target.
424Note that these messages cannot be disabled on all targets.
425</p>
426<a name="index-show-print-thread_002devents"></a>
427</dd>
428<dt><code>show print thread-events</code></dt>
429<dd><p>Show whether messages will be printed when <small>GDB</small> detects that threads
430have started and exited.
431</p></dd>
432</dl>
433
434<p>See <a href="Thread-Stops.html#Thread-Stops">Stopping and Starting Multi-thread Programs</a>, for
435more information about how <small>GDB</small> behaves when you stop and start
436programs with multiple threads.
437</p>
438<p>See <a href="Set-Watchpoints.html#Set-Watchpoints">Setting Watchpoints</a>, for information about
439watchpoints in programs with multiple threads.
440</p>
441<a name="set-libthread_002ddb_002dsearch_002dpath"></a><dl compact="compact">
442<dd><a name="index-set-libthread_002ddb_002dsearch_002dpath"></a>
443<a name="index-search-path-for-libthread_005fdb"></a>
444</dd>
445<dt><code>set libthread-db-search-path <span class="roman">[</span><var>path</var><span class="roman">]</span></code></dt>
446<dd><p>If this variable is set, <var>path</var> is a colon-separated list of
447directories <small>GDB</small> will use to search for <code>libthread_db</code>.
448If you omit <var>path</var>, &lsquo;<samp>libthread-db-search-path</samp>&rsquo; will be reset to
449its default value (<code>$sdir:$pdir</code> on <small>GNU</small>/Linux and Solaris systems).
450Internally, the default value comes from the <code>LIBTHREAD_DB_SEARCH_PATH</code>
451macro.
452</p>
453<p>On <small>GNU</small>/Linux and Solaris systems, <small>GDB</small> uses a &ldquo;helper&rdquo;
454<code>libthread_db</code> library to obtain information about threads in the
455inferior process.  <small>GDB</small> will use &lsquo;<samp>libthread-db-search-path</samp>&rsquo;
456to find <code>libthread_db</code>.  <small>GDB</small> also consults first if inferior
457specific thread debugging library loading is enabled
458by &lsquo;<samp>set auto-load libthread-db</samp>&rsquo; (see <a href="libthread_005fdb_002eso_002e1-file.html#libthread_005fdb_002eso_002e1-file">libthread_db.so.1 file</a>).
459</p>
460<p>A special entry &lsquo;<samp>$sdir</samp>&rsquo; for &lsquo;<samp>libthread-db-search-path</samp>&rsquo;
461refers to the default system directories that are
462normally searched for loading shared libraries.  The &lsquo;<samp>$sdir</samp>&rsquo; entry
463is the only kind not needing to be enabled by &lsquo;<samp>set auto-load libthread-db</samp>&rsquo;
464(see <a href="libthread_005fdb_002eso_002e1-file.html#libthread_005fdb_002eso_002e1-file">libthread_db.so.1 file</a>).
465</p>
466<p>A special entry &lsquo;<samp>$pdir</samp>&rsquo; for &lsquo;<samp>libthread-db-search-path</samp>&rsquo;
467refers to the directory from which <code>libpthread</code>
468was loaded in the inferior process.
469</p>
470<p>For any <code>libthread_db</code> library <small>GDB</small> finds in above directories,
471<small>GDB</small> attempts to initialize it with the current inferior process.
472If this initialization fails (which could happen because of a version
473mismatch between <code>libthread_db</code> and <code>libpthread</code>), <small>GDB</small>
474will unload <code>libthread_db</code>, and continue with the next directory.
475If none of <code>libthread_db</code> libraries initialize successfully,
476<small>GDB</small> will issue a warning and thread debugging will be disabled.
477</p>
478<p>Setting <code>libthread-db-search-path</code> is currently implemented
479only on some platforms.
480</p>
481<a name="index-show-libthread_002ddb_002dsearch_002dpath"></a>
482</dd>
483<dt><code>show libthread-db-search-path</code></dt>
484<dd><p>Display current libthread_db search path.
485</p>
486<a name="index-set-debug-libthread_002ddb"></a>
487<a name="index-show-debug-libthread_002ddb"></a>
488<a name="index-debugging-libthread_005fdb"></a>
489</dd>
490<dt><code>set debug libthread-db</code></dt>
491<dt><code>show debug libthread-db</code></dt>
492<dd><p>Turns on or off display of <code>libthread_db</code>-related events.
493Use <code>1</code> to enable, <code>0</code> to disable.
494</p></dd>
495</dl>
496
497<hr>
498<div class="header">
499<p>
500Next: <a href="Forks.html#Forks" accesskey="n" rel="next">Forks</a>, Previous: <a href="Inferiors-Connections-and-Programs.html#Inferiors-Connections-and-Programs" accesskey="p" rel="previous">Inferiors Connections and Programs</a>, Up: <a href="Running.html#Running" accesskey="u" rel="up">Running</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>
501</div>
502
503
504
505</body>
506</html>
507