Initial Commit
[packages] / xemacs-packages / jde / java / src / jde / debugger / Protocol.java
1 package jde.debugger;
2
3 /**
4  * Protocol.java
5  * <p>
6  * Repository of all commands sent from jde to jdebug, and all lisp functions
7  * sent from jdebug to jde
8  * <p>
9  *
10  * <b>Nomenclature:</b>
11  * 
12  * <dt> jdebug: </dt>
13  * <dd> The java side of the debugger </dd>
14  *
15  * <dt> jde: </dt>
16  * <dd> The emacs side of the debugger. Also used in general terms to
17  *      mean JDE itself. </dd>
18  *
19  * <dt> JDE: </dt>
20  * <dd> The java development environment </dd>
21  *
22  * <dt> debugger: </dt>
23  * <dd> Usually the java side, also used in general
24  *      terms to mean the full debugging framework </dd>
25  *
26  * <dt> debugee: </dt>
27  * <dd> The application being debugged. Usually means
28  *      the VM of the application, as against the VM
29  *      of the debugger. </dd>
30  *
31  * <dt> application: </dt>
32  * <dd> Same as 'debugee' </dd>
33  *
34  * <dt> VM: </dt>
35  * <dd> The java virtual machine. During debugging,
36  *      the debugger VM connects to the debuggee VM
37  *      through a socket/shared memory (the latter is
38  *      possible in case of Win9x/NT)
39  * <p>
40  *
41  *
42  * <b> Commands </b>
43  * <p>
44  * The commands will be ASCII strings delimited by spaces, and
45  * will end with a  BR .
46  * <pre>
47  *      debugee_vm_id command_id command [optional_args]
48  * </pre>
49  *
50  * <dt> debugee_vm_id </dt>
51  * <dd> a number that is assigned during handshake
52  *      between the emacs and the jde sides,
53  *      representing a specific debugee vm.
54  *      <p>
55  *      if (id == -1), the command is not specific to
56  *      any debugee vm.
57  *      <p>
58  *      'app_id', 'vm_id' 'id' & 'debugee_vm_id' are
59  *      synonymous. </dd>
60  *
61  * <dt> command_id </dt>
62  * <dd> an id that helps match a command and its response.
63  *      <p>
64  *      'cmd_id' 'cid' & 'command_id' are synonymous. </dd>
65  *
66  * <dt> command </dt>
67  * <dd> plain text command </dd>
68  *
69  * <dt> optional_args </dt>
70  * <dd> arguments for the command. can use "" for
71  *      arguments with white spaces. </dd>
72  * <p>
73  *
74  *
75  * <b> Replies </b>
76  * <p>
77  * The replies to these commands will be ASCII too, in lisp
78  * forms, and will also end with a  BR . They will either by
79  * "result" or "error":
80  * <pre>
81  *      (jde-dbo-command-result command_id [optional_args])
82  *      (jde-dbo-command-error command_id reason)
83  * </pre>
84  *
85  * <dt> debugee_vm_id, command_id </dt>
86  * <dd> as above </dd>
87  *
88  * <dt> optional_args </dt>
89  * <dd> if required </dd>
90  * 
91  * <dt> reason </dt>
92  * <dd> a string, containing the error message </dd>
93  * <p>
94  *
95  *
96  * <b> Event Sets </b>
97  * See {@link EventHandler here}
98  * <p>
99  *
100  * <p>
101  * Created: Thu Jul  8 13:44:10 1999
102  * 
103  * @author Amit Kumar
104  * @since 0.1
105  * @version $Revision: 1.3 $
106  */
107
108 public interface Protocol  {
109
110     /*
111      *
112      * Some useful constants
113      *
114      */
115
116     /** line break, platform dependent */
117     public static String BR = System.getProperty("line.separator");
118
119
120     /*
121      *
122      * Supported Commands from jde to jdebug
123      *
124      */
125
126     
127     /*
128      * Specifying the debuggee application
129      */
130
131     /** @see jde.debugger.command.LaunchApplication */
132     public final static String LAUNCH = "launch";
133     
134     /** @see jde.debugger.command.AttachSocket */
135     public final static String ATTACH_SOCKET = "attach_socket";
136
137     /** @see jde.debugger.command.AttachShmem */
138     public final static String ATTACH_SHMEM = "attach_shmem";
139     
140     /** @see jde.debugger.command.ListenSocket */
141     public final static String LISTEN_SOCKET = "listen_socket";
142
143     /** @see jde.debugger.command.ListenShmem */
144     public final static String LISTEN_SHMEM = "listen_shmem";
145
146     /*
147      * Others
148      */
149     
150     /** @see jde.debugger.command.Quit */
151     public final static String QUIT = "quit";
152     /** @see jde.debugger.command.Quit */
153     public final static String EXIT = "exit";
154
155     /*
156      * Following commands are application specific: ie are directed
157      * towards an application once it has been launched/attached to/ etc.
158      */
159
160     /** @see jde.debugger.command.Run */
161     public final static String RUN = "run";
162
163     /** @see jde.debugger.command.Finish */
164     public final static String FINISH = "finish";
165
166     /** @see jde.debugger.command.TraceClasses */
167     public final static String TRACE_CLASSES = "trace_classes";
168     /** @see jde.debugger.command.CancelTraceClasses */
169     public final static String CANCEL_TRACE_CLASSES = "cancel_trace_classes";
170
171
172     /** @see jde.debugger.command.TraceExceptions */
173     public final static String TRACE_EXCEPTIONS = "trace_exceptions";
174     /** @see jde.debugger.command.Watch */
175     public final static String WATCH = "watch";
176     /** @see jde.debugger.command.Break */
177     public final static String BREAK = "break";
178     /** @see jde.debugger.command.Clear */
179     public final static String CLEAR = "clear";
180
181     /** @see jde.debugger.command.Step */
182     public final static String STEP = "step";
183
184     /** @see jde.debugger.command.Suspend */
185     public final static String SUSPEND = "suspend";
186     /** @see jde.debugger.command.Resume */
187     public final static String RESUME = "resume";
188     /** @see jde.debugger.command.Interrupt */
189     public final static String INTERRUPT = "interrupt";
190     /** @see jde.debugger.command.KillThread */
191     public final static String KILL_THREAD = "kill_thread";
192
193     /** @see jde.debugger.command.GetThreads */
194     public final static String GET_THREADS = "get_threads";
195     /** @see jde.debugger.command.GetThread */
196     public final static String GET_THREAD = "get_thread";
197     /** @see jde.debugger.command.GetObjectMonitors */
198     public final static String GET_OBJECT_MONITORS = "get_object_monitors";
199     /** @see jde.debugger.command.TraceThreads */
200     public final static String TRACE_THREADS = "trace_threads";
201     /** @see jde.debugger.command.CancelTraceThreads */
202     public final static String CANCEL_TRACE_THREADS = "cancel_trace_threads";
203
204     /** @see jde.debugger.command.TraceMethods */
205     public final static String TRACE_METHODS = "trace_methods";
206     /** @see jde.debugger.command.CancelTraceMethods */
207     public final static String CANCEL_TRACE_METHODS = "cancel_trace_methods";
208     
209     /** @see jde.debugger.command.GetObject */
210     public final static String GET_OBJECT = "get_object";
211
212   /** @see jde.debugger.command.GetArray */
213   public final static String GET_ARRAY = "get_array";
214
215     /** @see jde.debugger.command.GetString */
216     public final static String GET_STRING = "get_string";
217
218     /** @see jde.debugger.command.GetLocals */
219     public final static String GET_LOCALS = "get_locals";
220
221     /** @see jde.debugger.command.GetLoadedClasses */
222     public final static String GET_LOADED_CLASSES = "get_loaded_classes";
223     /** @see jde.debugger.command.GetPathInfo */
224     public final static String GET_PATH_INFORMATION = "get_path_information";
225
226     /** @see jde.debugger.command.EvaluateExpression */
227     public final static String EVALUATE = "evaluate";
228
229
230     /*
231      *
232      * Commands end
233      *
234      */
235
236
237
238
239     
240
241     // lisp functions sent from jdebug to jde
242
243     /** arbitrary lisp functions passed to jde start with this*/
244     public final static String JDE_BUG =
245         "jde-dbo-";
246
247     /** the very first function, indicating that jdebug is up and running */
248     public final static String JDE_INIT_DEBUG_SESSION =
249         JDE_BUG+"init-debug-session";
250
251     /** The command executed properly, returns the result */
252     public final static String COMMAND_RESULT =
253         "command-result";
254     /** There was an error executing the command, returns the error */
255     public final static String COMMAND_ERROR =
256         "command-error";
257
258     /** A message to be displayed on the JDE UI */
259     public final static String MESSAGE =
260         "message";
261     /** A warning */
262     public final static String WARNING =
263         "warning";
264     /** an error */
265     public final static String ERROR =
266         "error";
267
268     /** a debug message */
269     public final static String DEBUG =
270         "debug";
271
272     /** Event sets caused by the jpda. */
273     public final static String EVENTSET =
274         "event-set";
275
276     /** used to construct messages about invalid breakpoints etc. */
277     public final static String INVALID =
278         "invalid-";
279
280     /**
281      * tell jdebug to inform jdebug about references to objects being
282      * currently used. might dissapear soon...
283      */
284     public final static String REPORT_IDS_IN_USE =
285         "report-ids-in-use";
286
287     /**
288      * Notifies that a connection to a vm was successfully made
289      */
290     public final static String CONNECTED_TO_VM =
291         "connected-to-vm";
292
293     /**
294      * Notifies that a spec was resolved properly
295      */
296     public final static String SPEC_RESOLVED =
297         "spec-resolved";
298
299
300     /*
301      *
302      * Events that are raised by the JDI implementation
303      *
304      */
305      
306
307     /** @see EventHandler#breakpointEvent(BreakpointEvent) */
308     public final static String EVENT_BREAKPOINT_HIT =
309         JDE_BUG+"breakpoint-hit-event";
310     /** @see EventHandler#stepEvent(StepEvent) */
311     public final static String EVENT_STEP_COMPLETED =
312         JDE_BUG+"step-event";
313
314     /** @see EventHandler#watchpointEvent(WatchpointEvent) */
315     public final static String EVENT_WATCHPOINT_HIT =
316         JDE_BUG+"watchpoint-hit-event";
317
318     /** @see EventHandler#classPrepareEvent(ClassPrepareEvent) */
319     public final static String EVENT_CLASS_PREPARE =
320         JDE_BUG+"class-prepare-event";
321     /** @see EventHandler#classUnloadEvent(ClassUnloadEvent) */
322     public final static String EVENT_CLASS_UNLOAD =
323         JDE_BUG+"class-unload-event";
324
325     /** @see EventHandler#exceptionEvent(ExceptionEvent) */
326     public final static String EVENT_EXCEPTION =
327         JDE_BUG+"exception-event";
328
329     /** @see EventHandler#threadStartEvent(ThreadStartEvent) */
330     public final static String EVENT_THREAD_START =
331         JDE_BUG+"thread-start-event";
332     /** @see EventHandler#threadDeathEvent(ThreadDeathEvent) */
333     public final static String EVENT_THREAD_DEATH =
334         JDE_BUG+"thread-death-event";
335
336     /** @see EventHandler#methodEntryEvent(MethodEntryEvent) */
337     public final static String EVENT_METHOD_ENTRY =
338         JDE_BUG+"method-entry-event";
339     /** @see EventHandler#methodExitEvent(MethodExitEvent) */
340     public final static String EVENT_METHOD_EXIT =
341         JDE_BUG+"method-exit-event";
342
343     /** @see EventHandler#vmStartEvent(Event) */
344     public final static String EVENT_VM_START =
345         JDE_BUG+"vm-start-event";
346     /** @see EventHandler#vmDeathEvent(Event) */
347     public final static String EVENT_VM_DEATH =
348         JDE_BUG+"vm-death-event";
349     /** @see EventHandler#vmDisconnectEvent(Event) */
350     public final static String EVENT_VM_DISCONNECT =
351         JDE_BUG+"vm-disconnected-event";
352
353     /** @see EventHandler#otherEvent(Event) */
354     public final static String EVENT_OTHER =
355         JDE_BUG+"event-other";
356
357     /*
358      *
359      * Events end
360      *
361      */
362
363     // Constants for signalling through the JDE class
364     public final static boolean QUOTE   = true;
365     public final static boolean NOQUOTE = false;
366     public final static boolean CMD_OK  = true;
367     public final static boolean CMD_NOK = false;
368
369
370     /** 
371      * No trace output
372      */
373     public final static int NONE      = 0;
374     /**
375      * Trace application I/O - CURRENTLY NOT USED
376      */
377     public final static int APP_IO    = 1;
378     /**
379      * Trace pipe between Emacs and Java - CURRENTLY NOT USED
380      */
381     public final static int JDE_PIPE  = 2;
382     /**
383      * Trace anything related to events.
384      */
385     public final static int EVENTS    = 4;
386     /**
387      * Trace exceptions
388      */
389     public final static int EXCEPTION = 8;
390     /**
391      * Trace the functioning of the framework: debugging process
392      * administration, etc.
393      */
394     public final static int FRAMEWORK = 16;
395     /**
396      * Trace command execution
397      */
398     public final static int COMMANDS  = 32;
399     /**
400      * Trace GUI
401      */
402     public final static int GUI       = 64;
403
404 } // Protocol
405
406 /*
407  * $Log: Protocol.java,v $
408  * Revision 1.3  2003/01/08 06:53:37  paulk
409  * Integrate Petter Mahlen's updates.
410  *
411  */