jdk/src/solaris/doc/sun/man/man1/jdb.1
author tbell
Mon, 04 May 2009 18:28:26 -0700
changeset 2692 345bc8d65b19
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6837214: Update JDK7 man pages Reviewed-by: darcy, bpatel, tbell Contributed-by: jacob.royal@sun.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
     1
." Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
." DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
." This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
." under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
." published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
." This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
." ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
." FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
." version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
." accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
." You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
." 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
." Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
." Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
." CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
." have any questions.
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    21
."
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    22
.TH jdb 1 "04 May 2009"
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    23
." Generated from HTML by html2man (author: Eric Armstrong)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    26
.SH "Name"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
jdb \- The Java Debugger
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    29
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
\f3jdb\fP helps you find and fix bugs in Java language programs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    35
.RE
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
.SH "SYNOPSIS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
\fP\f3jdb\fP [ options ] [ class ] [ arguments ] 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    51
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
options 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
Command\-line options, as specified below. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
class 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
Name of the class to begin debugging. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
arguments 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
Arguments passed to the \f2main()\fP method of \f2class\fP. 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    61
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    62
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
.SH "DESCRIPTION"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
The Java Debugger, \f3jdb\fP, is a simple command\-line debugger for Java classes. It is a demonstration of the 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
\f2Java Platform Debugger Architecture\fP @
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
http://java.sun.com/javase/6/docs/technotes/guides/jpda/index.html that provides inspection and debugging of a local or remote Java Virtual Machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
Starting a jdb Session
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
    79
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
There are many ways to start a jdb session. The most frequently used way is to have \f3jdb\fP launch a new Java Virtual Machine (VM) with the main class of the application to be debugged. This is done by substituting the command \f3jdb\fP for \f3java\fP in the command line. For example, if your application's main class is MyClass, you use the following command to debug it under JDB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 % jdb MyClass 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
When started this way, \f3jdb\fP invokes a second Java VM with any specified parameters, loads the specified class, and stops the VM before executing that class's first instruction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
Another way to use \f3jdb\fP is by attaching it to a Java VM that is already running. Syntax for Starting a VM to which jdb will attach when the VM is running is as follows. This loads in\-process debugging libraries and specifies the kind of connection to be made.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
\-agentlib:jdwp=transport=dt_socket,server=y,suspend=n
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
For example, the following command will run the MyClass application, and allow \f3jdb\fP to connect to it at a later time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 % java \-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n MyClass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
You can then attach \f3jdb\fP to the VM with the following commmand:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 % jdb \-attach 8000 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
Note that "MyClass" is not specified in the \f3jdb\fP command line in this case because \f3jdb\fP is connecting to an existing VM instead of launching a new one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
There are many other ways to connect the debugger to a VM, and all of them are supported by \f3jdb\fP. The Java Platform Debugger Architecture has additional 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
\f2documentation\fP @
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   141
http://java.sun.com/javase/6/docs/technotes/guides/jpda/conninv.html on these connection options. For information on starting a J2SE 1.4.2 or early VM for use with \f3jdb\fP see the 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
\f21.4.2 documentation\fP @
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
.fi
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   145
http://java.sun.com/j2se/1.4.2/docs/guide/jpda/conninv.html
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
Basic jdb Commands
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
The following is a list of the basic \f3jdb\fP commands. The Java debugger supports other commands which you can list using \f3jdb\fP's \f2help\fP command.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   156
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
help, or ? 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
The most important \f3jdb\fP command, \f2help\fP displays the list of recognized commands with a brief description. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
run 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
After starting \f3jdb\fP, and setting any necessary breakpoints, you can use this command to start the execution the debugged application. This command is available only when \f3jdb\fP launches the debugged application (as opposed to attaching to an existing VM). 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
cont 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
Continues execution of the debugged application after a breakpoint, exception, or step. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
print 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
Displays Java objects and primitive values. For variables or fields of primitive types, the actual value is printed. For objects, a short description is printed. See the \f2dump\fP command below for getting more information about an object. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   170
\f2NOTE: To display local variables, the containing class must have been compiled with the \fP\f2javac(1)\fP\f2 \fP\f2\-g\fP option. 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
\f2print\fP supports many simple Java expressions including those with method invocations, for example: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   175
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
\f2print MyClass.myStaticField\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   178
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
\f2print myObj.myInstanceField\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   181
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
\f2print i + j + k\fP \f2(i, j, k are primities and either fields or local variables)\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   184
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
\f2print myObj.myMethod()\fP \f2(if myMethod returns a non\-null)\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   187
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
\f2print new java.lang.String("Hello").length()\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
dump 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
For primitive values, this command is identical to \f2print\fP. For objects, it prints the current value of each field defined in the object. Static and instance fields are included. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
The \f2dump\fP command supports the same set of expressions as the \f2print\fP command.  
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
threads 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
List the threads that are currently running. For each thread, its name and current status are printed, as well as an index that can be used for other commands, for example: 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
.nf
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
\f3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
4. (java.lang.Thread)0x1 main      running
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
.fl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
\fP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
In this example, the thread index is 4, the thread is an instance of java.lang.Thread, the thread name is "main", and it is currently running, 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
thread 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
Select a thread to be the current thread. Many \f3jdb\fP commands are based on the setting of the current thread. The thread is specified with the thread index described in the \f2threads\fP command above. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
where 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
\f2where\fP with no arguments dumps the stack of the current thread. \f2where all\fP dumps the stack of all threads in the current thread group. \f2where\fP \f2threadindex\fP dumps the stack of the specified thread. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
If the current thread is suspended (either through an event such as a breakpoint or through the \f2suspend\fP command), local variables and fields can be displayed with the \f2print\fP and \f2dump\fP commands. The \f2up\fP and \f2down\fP commands select which stack frame is current.  
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   218
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   219
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
Breakpoints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   225
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
Breakpoints can be set in \f3jdb\fP at line numbers or at the first instruction of a method, for example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
.RS 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   233
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
\f2stop at MyClass:22\fP \f2(sets a breakpoint at the first instruction for line 22 of the source file containing MyClass)\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   236
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
\f2stop in java.lang.String.length\fP \f2(sets a breakpoint at the beginnig of the method \fP\f2java.lang.String.length\fP) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   239
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
\f2stop in MyClass.<init>\fP \f2(<init> identifies the MyClass constructor)\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
.TP 2
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   242
o
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
\f2stop in MyClass.<clinit>\fP \f2(<clinit> identifies the static initialization code for MyClass)\fP 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
.RE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
If a method is overloaded, you must also specify its argument types so that the proper method can be selected for a breakpoint. For example, "\f2MyClass.myMethod(int,java.lang.String)\fP", or "\f2MyClass.myMethod()\fP".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
The \f2clear\fP command removes breakpoints using a syntax as in "\f2clear\ MyClass:45\fP". Using the \f2clear\fP or command with no argument displays a list of all breakpoints currently set. The \f2cont\fP command continues execution.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   253
.RE
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
Stepping
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   257
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
The \f2step\fP commands advances execution to the next line whether it is in the current stack frame or a called method. The \f2next\fP command advances execution to the next line in the current stack frame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   263
.RE
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
Exceptions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   267
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
When an exception occurs for which there isn't a catch statement anywhere in the throwing thread's call stack, the VM normally prints an exception trace and exits. When running under \f3jdb\fP, however, control returns to \f3jdb\fP at the offending throw. You can then use \f3jdb\fP to diagnose the cause of the exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
Use the \f2catch\fP command to cause the debugged application to stop at other thrown exceptions, for example: "\f2catch java.io.FileNotFoundException\fP" or "\f2catch mypackage.BigTroubleException\fP. Any exception which is an instance of the specifield class (or of a subclass) will stop the application at the point where it is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
The \f2ignore\fP command negates the effect of a previous \f2catch\fP command.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
\f2NOTE: The \fP\f2ignore\fP command does not cause the debugged VM to ignore specific exceptions, only the debugger.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   282
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   283
.RE
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
.SH "Command Line Options"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
When you use \f3jdb\fP in place of the Java application launcher on the command line, \f3jdb\fP accepts many of the same options as the java command, including \f2\-D\fP, \f2\-classpath\fP, and \f2\-X<option>\fP.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
The following additional options are accepted by \f3jdb\fP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   294
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
\-help 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
Displays a help message. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
\-sourcepath <dir1:dir2:...> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
Uses the given path in searching for source files in the specified path. If this option is not specified, the default path of "." is used. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
\-attach <address> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
Attaches the debugger to previously running VM using the default connection mechanism. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
\-listen <address> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
Waits for a running VM to connect at the specified address using standard connector. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
\-listenany 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
Waits for a running VM to connect at any available address using standard connector. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
\-launch 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
Launches the debugged application immediately upon startup of jdb. This option removes the need for using the \f2run\fP command. The debuged application is launched and then stopped just before the initial application class is loaded. At that point you can set any necessary breakpoints and use the \f2cont\fP to continue execution. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
\-listconnectors 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
List the connectors available in this VM 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   317
\-connect <connector\-name>:<name1>=<value1>,... 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
Connects to target VM using named connector with listed argument values. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
\-dbgtrace [flags] 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
Prints info for debugging jdb. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
\-tclient 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
Runs the application in the Java HotSpot(tm) VM (Client). 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
\-tserver 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
Runs the application in the Java HotSpot(tm) VM (Server). 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
\-Joption 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
Pass \f2option\fP to the Java virtual machine used to run jdb. (Options for the application Java virtual machine are passed to the \f3run\fP command.) For example, \f3\-J\-Xms48m\fP sets the startup memory to 48 megabytes. 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   331
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   332
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
Other options are supported for alternate mechanisms for connecting the debugger and the VM it is to debug. The Java Platform Debugger Architecture has additional 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
.na
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
\f2documentation\fP @
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
.fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
http://java.sun.com/javase/6/docs/technotes/guides/jpda/conninv.html on these connection alternatives.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
.SS 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
Options Forwarded to Debuggee Process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   344
.RS 3
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
\-v \-verbose[:class|gc|jni] 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
Turns on verbose mode. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
\-D<name>=<value> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
Sets a system property. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
.TP 3
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   352
\-classpath <directories separated by ":"> 
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
Lists directories in which to look for classes. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
.TP 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
\-X<option> 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
Non\-standard target VM option 
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   357
.RE
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   358
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
.SH "SEE ALSO"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
.LP
2692
345bc8d65b19 6837214: Update JDK7 man pages
tbell
parents: 2
diff changeset
   365
javac(1), java(1), javah(1), javap(1), javadoc(1).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
.LP
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369