1 /*
2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 package nsk.share.jdb;
25 
26 /**
27  * Represents list of commands of <code>jdb</code> from JDK1.4:
28  *
29  *   run [class [args]]        -- start execution of application's main class
30  *
31  *   threads [threadgroup]     -- list threads
32  *   thread <thread id>        -- set default thread
33  *   suspend [thread id(s)]    -- suspend threads (default: all)
34  *   resume [thread id(s)]     -- resume threads (default: all)
35  *   where [thread id] | all   -- dump a thread's stack
36  *   wherei [thread id] | all  -- dump a thread's stack, with pc info
37  *   up [n frames]             -- move up a thread's stack
38  *   down [n frames]           -- move down a thread's stack
39  *   kill <thread> <expr>      -- kill a thread with the given exception object
40  *   interrupt <thread>        -- interrupt a thread
41  *
42  *   print <expr>              -- print value of expression
43  *   dump <expr>               -- print all object information
44  *   eval <expr>               -- evaluate expression (same as print)
45  *   set <lvalue> = <expr>     -- assign new value to field/variable/array element
46  *   locals                    -- print all local variables in current stack frame
47  *
48  *   classes                   -- list currently known classes
49  *   class <class id>          -- show details of named class
50  *   methods <class id>        -- list a class's methods
51  *   fields <class id>         -- list a class's fields
52  *
53  *   threadgroups              -- list threadgroups
54  *   threadgroup <name>        -- set current threadgroup
55  *
56  *   stop in <class id>.<method>[(argument_type,...)]
57  *                             -- set a breakpoint in a method
58  *   stop at <class id>:<line> -- set a breakpoint at a line
59  *   clear <class id>.<method>[(argument_type,...)]
60  *                             -- clear a breakpoint in a method
61  *   clear <class id>:<line>   -- clear a breakpoint at a line
62  *   clear                     -- list breakpoints
63  *   catch <class id>          -- break when specified exception thrown
64  *   ignore <class id>         -- cancel 'catch'  for the specified exception
65  *   watch [access|all] <class id>.<field name>
66  *                             -- watch access/modifications to a field
67  *   unwatch [access|all] <class id>.<field name>
68  *                             -- discontinue watching access/modifications to a field
69  *   trace methods [thread]    -- trace method entry and exit
70  *   untrace methods [thread]  -- stop tracing method entry and exit
71  *   step                      -- execute current line
72  *   step up                   -- execute until the current method returns to its caller
73  *   stepi                     -- execute current instruction
74  *   next                      -- step one line (step OVER calls)
75  *   cont                      -- continue execution from breakpoint
76  *
77  *   list [line number|method] -- print source code
78  *   use (or sourcepath) [source file path]
79  *                             -- display or change the source path
80  *   exclude [class id ... | "none"]
81  *                             -- do not report step or method events for specified classes
82  *   classpath                 -- print classpath info from target VM
83  *
84  *   monitor <command>         -- execute command each time the program stops
85  *   monitor                   -- list monitors
86  *   unmonitor <monitor#>      -- delete a monitor
87  *   read <filename>           -- read and execute a command file
88  *
89  *   lock <expr>               -- print lock info for an object
90  *   threadlocks [thread id]   -- print lock info for a thread
91  *
92  *   pop                       -- pop the stack through and including the current frame
93  *   reenter                   -- same as pop, but current frame is reentered
94  *   redefine <class id> <class file name>
95  *                             -- redefine the code for a class
96  *
97  *   disablegc <expr>          -- prevent garbage collection of an object
98  *   enablegc <expr>           -- permit garbage collection of an object
99  *
100  *   !!                        -- repeat last command
101  *   <n> <command>             -- repeat command n times
102  *   help (or ?)               -- list commands
103  *   version                   -- print version information
104  *   exit (or quit)            -- exit debugger
105  *
106  *   <class id>: full class name with package qualifiers or a
107  *   pattern with a leading or trailing wildcard ('*').
108  *   <thread id>: thread number as reported in the 'threads' command
109  *   <expr>: a Java(tm) Programming Language expression.
110  *   Most common syntax is supported.
111  *
112  *   Startup commands can be placed in either "jdb.ini" or ".jdbrc"
113  *   in user.home or user.dir
114  */
115 public class JdbCommand {
116     public static final String ls = System.getProperty("line.separator");
117 
118     public static final String _catch       = "catch ";
119     public static final String _class       = "class ";
120     public static final String classes      = "classes" + ls;
121     public static final String classpath    = "classpath" + ls;
122     public static final String clear        = "clear ";
123     public static final String cont         = "cont" + ls;
124     public static final String disablegc    = "disablegc ";
125     public static final String down         = "down ";
126     public static final String dump         = "dump ";
127     public static final String enablegc     = "enablegc";
128     public static final String eval         = "eval ";
129     public static final String exit         = "exit" + ls;
130     public static final String exclude      = "exclude ";
131     public static final String fields       = "fields ";
132     public static final String help         = "help" + ls;
133     public static final String ignore       = "ignore ";
134     public static final String interrupt    = "interrupt ";
135     public static final String kill         = "kill ";
136     public static final String list         = "list ";
137     public static final String locals       = "locals" + ls;
138     public static final String lock         = "lock ";
139     public static final String methods      = "methods ";
140     public static final String monitor      = "monitor ";
141     public static final String next         = "next" + ls;
142     public static final String pop          = "pop" + ls;
143     public static final String print        = "print ";
144     public static final String quit         = "quit" + ls;
145     public static final String read         = "read ";
146     public static final String redefine     = "redefine ";
147     public static final String reenter      = "reenter" + ls;
148     public static final String resume       = "resume ";
149     public static final String run          = "run ";
150     public static final String set          = "set ";
151     public static final String step         = "step" + ls;
152     public static final String stepi        = "stepi" + ls;
153     public static final String step_up      = "step up" + ls;
154     public static final String stop_in      = "stop in ";
155     public static final String stop_at      = "stop at ";
156     public static final String suspend      = "suspend ";
157     public static final String thread       = "thread ";
158     public static final String threads      = "threads ";
159     public static final String threadgroup  = "threadgroup ";
160     public static final String threadgroups = "threadgroups" + ls;
161     public static final String threadlocks  = "threadlocks ";
162     public static final String trace        = "trace ";
163     public static final String watch        = "watch ";
164     public static final String where        = "where ";
165     public static final String where_all    = "where all" + ls;
166     public static final String wherei       = "wherei ";
167     public static final String wherei_all   = "wherei all" + ls;
168     public static final String unmonitor    = "unmonitor ";
169     public static final String untrace      = "untrace ";
170     public static final String unwatch      = "unwatch ";
171     public static final String up           = "up ";
172     public static final String use          = "use ";
173     public static final String version      = "version" + ls;
174 }
175