~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to java/helpset/javahelp/org/netbeans/modules/java/helpset/docs/debug/debug_threads.html

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
Import upstream version 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<!--
 
3
*     Copyright � 2007 Sun Microsystems, Inc. All rights reserved.
 
4
*     Use is subject to license terms.
 
5
*
 
6
-->
 
7
<html>
 
8
<head>
 
9
<title>Debugging Threads in the IDE</title>
 
10
        <link rel="StyleSheet" href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/ide.css" type="text/css">
 
11
</head>
 
12
<body>
 
13
<h2>Debugging Threads in the IDE</h2>
 
14
<p><small><a href="#seealso">See Also</a></small></p>
 
15
<p>All the threads created in the current session are displayed in the Threads window.
 
16
  You can open the Threads window by choosing Window  &gt; Debugging &gt; Threads (Alt-Shift-7).</p>
 
17
  
 
18
<h3>Changing the Current Thread</h3>
 
19
<p> Only one thread is the current thread at any given time. By default, the
 
20
        current thread is the thread within the current session from which the debugger
 
21
        gained control. When you switch between threads to debug, the Call Stack and
 
22
        Local Variables windows are automatically updated to reflect the data applicable
 
23
        to that thread. </p>
 
24
        
 
25
<p><b>To change the current thread:</b></p>
 
26
<ul>
 
27
  <li>Double-click any thread in the Threads window to make it the current thread. </li>
 
28
</ul>
 
29
 
 
30
<h3>Suspending and Resuming Threads</h3>
 
31
<p> You can suspend execution of a thread if you think it is causing problems
 
32
  and then later resume the thread once the problem is solved. </p>
 
33
<p>In the Threads window, the icon to the left of the thread name indicates whether the thread
 
34
is suspended or waiting to be resumed.</p>
 
35
<table border="1" cellpadding="5" cellspacing="0">
 
36
        <tr align="left" valign="top">
 
37
                <th scope="col">Icon</th>
 
38
                <th scope="col">Description</th>
 
39
        </tr>
 
40
        <tr valign="top">
 
41
                <td><img src="images/CurrentThread.gif" alt="Current thread"></td>
 
42
                <td>Indicates the current thread</td>
 
43
        </tr>
 
44
        <tr valign="top">
 
45
                <td><img src="images/RunningThread.gif" alt="Running thread"></td>
 
46
                <td>Indicates a thread that is running and is not current</td>
 
47
        </tr>
 
48
        <tr valign="top">
 
49
                <td><img src="images/SuspendedThread.gif" alt="Suspended thread"></td>
 
50
                <td>Indicates a thread that is suspended and is not current</td>
 
51
        </tr>
 
52
        </table>
 
53
        <p>You can display the Suspend property as a boolean flag (True or False) 
 
54
        in the Threads window by clicking the columns button 
 
55
        (<img src="images/ChangeColumn.gif" alt="Change Column">) and select the Suspend checkbox. </p>
 
56
<ul class="note">
 
57
  <li>  The state of the Thread is independent of whether the thread is suspended
 
58
        or waiting to be resumed. A thread's state may be Running while the Suspend
 
59
        property is True. </li>
 
60
  </ul>
 
61
<p><b>To suspend or resume a thread:</b></p>
 
62
<ul>
 
63
  <li>Right-click the thread in the Threads window and choose the Resume or Suspend command. </li>
 
64
</ul>
 
65
 
 
66
<h3>Multi-threaded Applications</h3>
 
67
<p>When debugging a multi-threaded application, a step in a particular thread may be interrupted by
 
68
    a breakpoint encountered in some other thread.
 
69
This behavior is desirable in some cases but not in others.</p>
 
70
 
 
71
<p>Let us suppose you are stepping through a thread (<i>thread 1</i>), 
 
72
and one of the steps is interrupted by a breakpoint encountered in another thread (<i>thread 2</i>).
 
73
When this happens, the program counter is set to the breakpoint in <i>thread 2</i>.</p>
 
74
 
 
75
<p>You can continue stepping through your program in the following ways:</p>
 
76
 
 
77
<ul>
 
78
    <li>Continue stepping through your program from the breakpoint in <i>thread 2</i>.</li>
 
79
    <li>Step through the program from the previous step (in <i>thread 1</i>) and ignore the breakpoint in <i>thread 2</i>.    
 
80
    <p>To continue with the step in <i>thread 1</i>, do one of the following in the Threads window: </p>
 
81
    <ul>
 
82
        <li><b>Click Ignore Breakpoint.</b> Clicking this will cause the 
 
83
        debugger to ignore the specified breakpoint encountered in <i>thread 2</i> and you can continue to step
 
84
        through the program following <i>thread 1</i>.</li>
 
85
        <li><b>Click Ignore All Such Breakpoints.</b>
 
86
        Clicking this will cause the debugger to ignore all breakpoints that do not occur on <i>thread 1</i>
 
87
        until the end of the debugging session.</li>
 
88
    </ul></li>
 
89
</ul>
 
90
 
 
91
 
 
92
<h3>Viewing Source Code for a Thread</h3>
 
93
<p>You can view the source code of a thread in the IDE's Source Editor if you
 
94
think it is causing problems and want to examine it further.</p> 
 
95
<p><b>To view a thread's source:</b>
 
96
<ul>
 
97
  <li>Right-click the thread in the Threads window and choose Go To Source. 
 
98
      <p> If the source of the thread is available, the Source Editor jumps to the 
 
99
      current call on the thread's call stack. </p>
 
100
  </li>
 
101
</ul>
 
102
<dl>
 
103
    <dt><a name="seealso">See Also</a></dt>
 
104
    <dd><a href="debug_new_watch.html">Creating a Watch</a></dd>
 
105
    <dd><a href="debug_callstack.html">Using the Call Stack</a></dd>
 
106
    <dd><a href="debug_step.html">Stepping Through Your Program</a></dd>
 
107
</dl>
 
108
<hr>
 
109
<small><a href="../credits.html">Legal Notices</a></small>
 
110
<table border="0" cellpadding="50">
 
111
<tr><td>&nbsp;</td></tr>
 
112
</table>
 
113
</body>
 
114
</html>