|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--jde.debugger.JDE
JDE.java
This class is the main link between jdebug and jde. It has methods that allow communication between jde and jdebug, as well as a store of all the applications currently active. Commands that have valid app_ids interpret get passed on to the corresponding applications. If not, corresponding errors are sent on the pipe.
Look here
for the command/response formats, and
here
for information about handling of events,
including event set formats
Note that for each command sent by jde, there *has* to be a reply. (either a result or an error) For example, in case we're launching a thread, we should return true, even if the thread might bomb later on.
Handshake Since JDI supports different kinds of connections, (for example, it being possible to "launch" a debugger once an uncaught exception is raised), we should probably have some sort of a handshake mechanism preceding a debugging session, for each new vm.
For example, if the debugee vm is already running, during the handshake we might specify its address. On the other hand, if we want the debugger to *launch* a vm, we can do that during the handshake.
For our purposes, we will only support "launch" in the beginning.
The purpose of the handshake is to establish the debugee_vm_id <-> debugee VM binding. It is guaranteed that no events will be raised from jdebug for a debugee VM for which the handshake is not yet complete.
Created: Wed Jul 7 20:49:16 1999
Field Summary | |
(package private) java.util.Map |
applications
All the active applications are kept in a map of app_id -> app . |
(package private) java.io.BufferedReader |
in
|
static java.lang.Integer |
my_id
The ID of jdebug. |
(package private) java.io.PrintWriter |
out
|
private java.util.Collection |
pendingCommands
Each command has a command id associated with it, that is used by jde, to match with the corresponding result/error. |
Fields inherited from class java.lang.Thread |
contextClassLoader,
daemon,
eetop,
group,
inheritedAccessControlContext,
MAX_PRIORITY,
MIN_PRIORITY,
name,
NORM_PRIORITY,
priority,
single_step,
stillborn,
stopThreadPermission,
target,
threadInitNumber,
threadQ,
values |
Constructor Summary | |
JDE()
|
Method Summary | |
private void |
doAttach(java.lang.String type,
java.lang.Integer cmd_id,
java.util.List args)
'attach_socket' and 'attach_shmem' commands. |
private void |
doLaunch(java.lang.Integer cmd_id,
java.util.List args)
'launch' command. |
private void |
doListen(java.lang.String type,
java.lang.Integer cmd_id,
java.util.List args)
'listen_socket' and 'listen_shmem' commands. |
private void |
doQuit(java.lang.Integer cmd_id,
java.util.List arguments)
'quit' command. |
private void |
handleAppCommand(java.lang.Integer app_id,
java.lang.Integer cmd_id,
java.lang.String command,
java.util.List arguments)
Commands received from JDE that don't have app_id == -1 get funneled to handleAppCommand. |
private void |
handleGeneralCommand(java.lang.Integer cmd_id,
java.lang.String command,
java.util.List arguments)
Commands that are not meant for any particular app/vm are funneled to this method. |
private void |
initApplication(java.lang.String category,
java.lang.Integer cmd_id,
java.util.List args)
This method is actually called by doLaunch, doAttach, and doListen and does all the ugly work. |
void |
removeApplication(java.lang.Integer app_id)
called by Application.shutdown()
to remove it's own entry from
the applications collection here |
void |
run()
JDE is a thread: it reads a line at a time and executes the command therein |
private void |
setSyntax(java.io.StreamTokenizer st)
Sets the syntax of the input stream. |
private void |
shutdown()
Shuts down all the applications prior to exiting |
void |
signal(java.lang.Integer app_id,
java.lang.String type,
java.lang.Object obj)
Send an arbitrary lisp function across. |
void |
signalCommandError(java.lang.Integer app_id,
java.lang.Integer cmd_id,
java.lang.Object obj)
reply to a command with an error. |
void |
signalCommandResult(java.lang.Integer app_id,
java.lang.Integer cmd_id)
send the result of a command. |
void |
signalCommandResult(java.lang.Integer app_id,
java.lang.Integer cmd_id,
java.lang.Object obj)
the result of a command. |
private void |
signalReply(java.lang.Integer app_id,
java.lang.Integer cmd_id,
java.lang.Object obj,
java.lang.String type)
Signal a reply: a result or an error |
java.lang.String |
stringRep(java.lang.Object obj)
Returns a string representation of the object. |
Methods inherited from class java.lang.Thread |
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
java.io.BufferedReader in
java.io.PrintWriter out
java.util.Map applications
app_id -> app
.
The app_id uniquely idenifies the application: it's the duty
of the app to nicely remove itself from the map once it's finishedprivate java.util.Collection pendingCommands
Application
, see
Application.pendingCommands
),
and removes
them once the command processing is over.Note that in case the command is actually meant for one of the apps (ie as ascertained by matching the app_id), the id isn't stored in our Collection, but the applications. This means that, in fact, it is the tuple (app_id, cmd_id) that need be unique (assuming that a "general" command has a app_id of -1
public static final java.lang.Integer my_id
Constructor Detail |
public JDE() throws java.io.IOException
Method Detail |
private void setSyntax(java.io.StreamTokenizer st)
public void run()
private void handleGeneralCommand(java.lang.Integer cmd_id, java.lang.String command, java.util.List arguments)
cmd_id
- The ID of the command sent. The app_id was -1command
- The command itselfarguments
- And the arguments of the commandprivate void handleAppCommand(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.String command, java.util.List arguments)
app_id
- The ID of the application for which the command is
intendedcmd_id
- ID of the commandcommand
- The commandarguments
- And a list of the arguments of the commandprivate void initApplication(java.lang.String category, java.lang.Integer cmd_id, java.util.List args) throws JDEException
The real reason is that I realised too late that they share the same code :-(
private void doLaunch(java.lang.Integer cmd_id, java.util.List args) throws JDEException
Syntax:
launch app_id [-use_executable javax] classname [args]Comments:
private void doAttach(java.lang.String type, java.lang.Integer cmd_id, java.util.List args) throws JDEException
Syntax:
attach_socket app_id -port p_value [-host h_value] attach_shmem app_id nameComments:
private void doListen(java.lang.String type, java.lang.Integer cmd_id, java.util.List args) throws JDEException
Syntax:
listen_socket app_id port listen_shmem app_id name
private void doQuit(java.lang.Integer cmd_id, java.util.List arguments) throws JDEException
Syntax:
quit
public void removeApplication(java.lang.Integer app_id)
Application.shutdown()
to remove it's own entry from
the applications collection hereprivate void shutdown() throws JDEException
public java.lang.String stringRep(java.lang.Object obj)
public void signal(java.lang.Integer app_id, java.lang.String type, java.lang.Object obj)
app_id
- The application IDtype
- The function name. JDE_BUG gets added to
its beginningobj
- An arbitrary object. If a string, it's just printed out,
if a list, each of its elements is printed out, with a space after
each.private void signalReply(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.Object obj, java.lang.String type)
public void signalCommandResult(java.lang.Integer app_id, java.lang.Integer cmd_id)
public void signalCommandResult(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.Object obj)
public void signalCommandError(java.lang.Integer app_id, java.lang.Integer cmd_id, java.lang.Object obj)
obj
- Is usually a string explaining what went wrong.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |