Methods utilizing a debugging proxy

Information

  • Patent Application
  • 20050010678
  • Publication Number
    20050010678
  • Date Filed
    February 26, 2004
    20 years ago
  • Date Published
    January 13, 2005
    19 years ago
Abstract
A debugging proxy can be used to manage communication between a client and a debugger or debugging component. A debugging protocol can be used by the debugging proxy to facilitate communication management. A debugging protocol can provide for asynchronous messaging, and can allow for the communication of large grain messages. A debugging protocol can also implement a priority scheme that can be used to process messages between a client and a debugger based upon a priority assigned to each message.
Description
COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document of the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.


FIELD OF THE INVENTION

The present invention relates to the debugging and/or editing of software code.


BACKGROUND

Remote debugging systems are becoming evermore important for the growing Web application and Web services industry. These systems allow a developer to monitor, inspect, and control the execution of software running on a remote server. This is especially critical for diagnosing problems that show up after deploying the software, but cannot be reproduced in the local development environment.


Unfortunately, most remote debugging protocols (e.g., the Java Debugging Interface (JDI)) are inefficient and resource intensive. These protocols are implemented by sending a constant stream of fine-grained information about debugging requests, state information, and events. This results in a slow and unproductive experience for developers and requires more effective communications bandwidth than is otherwise necessary. Bandwidth utilization problems are exacerbated by the fact that fine grain debugging messages may use only a small portion of the fixed size network packets used to transmit them, increasing communications overhead by transmitting many packets that are largely empty.


To make matters worse, debugging protocols are designed to be synchronous, meaning a debugging client must stop and wait for the results from each request it sends before the client can send another request or continue processing. This “blocking and waiting” behavior often means the end user cannot enter their next command until the remote debugging system responds. Consequently, the user interface becomes sluggish and frustrating for the developer. This is true for both local and remote debugging.


Often, the user isn't even interested in the result returned by the debugger, which immediately gets thrown away when the user enters their next command. For example, users often want to step rapidly through each line of the code to see which instructions are executed under certain conditions. With a synchronous debugging protocol, the user must wait after each step command for the debugger to return information about the new line. However, that information is discarded without being examined as soon as the user enters the next step command.


These problems are more pronounced when the debugging client is a visual Integrated Development Environment (IDE). This IDE will usually generate many requests for debugging information automatically on behalf of the user, based on assumptions about the information the developer will “likely” want to inspect. Thus, when the IDE's assumptions are correct, the IDE can answer the user's most “likely” questions quickly from results cached in memory.


Unfortunately, this eager method for collecting debugging information does not come without a cost, but results in more requests being sent to the debugger and ultimately more waiting for more results that never get used. Some IDEs attempt to reduce the amount of information they request. However, when the user requests a piece of information the IDE did not anticipate, the user must wait longer for the IDE to request that information from the debugger. At a minimum, the IDE may request debugging information about running application state that is immediately visible to the programmer in the IDE. For example, FIG. 1 illustrates an IDE with the current local variables and current call stack visible. In this case, the IDE may request only information about each variable displayed in the local variables window and each frame of the call stack shown in the call stack window. However, if the user is just stepping through the executed instructions rapidly, she may never even look at these windows. Therefore, the information collected at each step is never actually used and the time and resources spent collecting this information is wasted.


BRIEF SUMMARY

Methods in accordance with embodiments of the present inventions can improve upon existing debugging approaches by utilizing a debugging proxy. A debugging proxy can be used to manage communication between a client and a debugger or debugging component. A debugging protocol can be used by the debugging proxy to facilitate communication management. A debugging protocol can provide for asynchronous messaging, and can allow for the communication of large grain messages. A debugging protocol can also implement a priority scheme that can be used to process messages between a client and a debugger based upon a priority assigned to each message.


Other features, aspects, and objects of the invention can be obtained from a review of the specification, the figures, and the claims.




BRIEF DESCRIPTION OF DRAWINGS


FIG. 1 is an illustration of an IDE system in accordance with the prior art.



FIG. 2 is an illustration of a debug proxy architecture in accordance with one embodiment of the present invention.




DETAILED DESCRIPTION

Methods in accordance with embodiments of the present invention overcome problems with existing debugging approaches by utilizing an efficient, responsive debugging proxy. The debugging proxy manages communication between the client and the debugger. Communication with the debugger is handled using the debugger's native interfaces (e.g., JDI) allowing the debugger to be used in any context where a standard debugger exists. The proxy may be located on the same machine or even in the same process as the debugger ensuring potentially inefficient communications are completed locally without requiring network resources.


Communication with a client can be handled using a new asynchronous debugging protocol that uses large grain messages. Such a protocol can also implement a priority scheme for ensuring high priority requests get answered quickly, and allowing lower priority requests to get automatically overridden (i.e., canceled) if the associated results are no longer needed by the client.


A large grain, asynchronous debugging protocol can be used to manage communication between the client and the debugging proxy. Instead of sending a constant stream of fine-grained debugging messages, a client can send larger debugging messages, and can send them less frequently than would otherwise be necessary. This can result in lower overall communication requirements and more efficient use of available bandwidth. Consequently, the results of debugging requests can be available to the client faster, especially for remote debugging sessions.


In addition, communications between a client and a debugging proxy can be asynchronous. Therefore, the client need not block and wait for the results of each debugging result it sends. Instead, a client can send a request and return control to the user, allowing the user to continue interacting with the client and sending commands. Therefore, the client can send several commands (e.g., step) without waiting for the results from the previous command to be returned and displayed. Results can be returned to the client asynchronously, allowing the client to update its display with the new information as that information becomes available, without disrupting the responsiveness of the debugging client to the user.


In addition to implementing a course grained and asynchronous protocol, a debugging proxy can implement a priority scheme that allows faster processing of higher priority commands. Thus, commands most likely to require a fast response to the user can bypass commands that don't require as fast a response.


Some higher priority debugging requests can also override, or effectively cancel, lower priority requests if there is no longer any need to complete them. For example, when a user steps into a new function, a debugging client may send a “step into” request followed by several lower priority requests, to get the values of variables in the new function scope. If the user immediately steps into another function before the values of variables are returned, the requests for those variables can be cancelled. The variables requested during the first step operation may no longer be visible in the new function scope after the second step operation. Therefore it can be safe to cancel the request instead of waiting for and ultimately discarding the results.


Architecture



FIG. 2 depicts a system in accordance with one embodiment of the present invention. In this embodiment, the client generates requests to the debug proxy in response to the user's interaction with the user interface. Debug requests are sent from the client to the proxy using a course grained debugging protocol. The debugging proxy examines each message, determines its priority and places it on a priority queue or, for an immediate priority message, sends it directly to a worker thread. If the message is an override message, the debug proxy removes all pending requests from the priority queue that have a lower priority than the override message.


In one embodiment, when the worker threads are not processing immediate priority requests, they dequeue and processes requests from the priority queue starting with the highest priority items first and working through the remaining items in reverse priority order (i.e., highest to lowest priority). For each course grained request, the proxy object creates a new worker thread, which generates the corresponding series of fine grained requests to the server conforming to the server's standard (but less efficient) debugging protocol and waits for the corresponding results. The debug proxy may create a separate worker thread for each course grained request so it can continue processing additional requests without waiting for results from previous requests.


The debugging proxy may be located on the same machine as the server or even in the same process as the debugger on the server. Therefore, potentially inefficient communications governed by the server's standard debugging protocol may execute locally without requiring unnecessary communication overhead or consuming network resources.


When a worker thread has all the required responses back from the server, it will aggregate the results into a single course grained message and place it in the response queue. The debugging proxy removes items from the response queue in order and sends them asynchronously to the client.


The debug listener in the client listens for asynchronous results from the server and notifies the UI as it receives them. The UI may then update its display based on the new information.


Some debugging requests sent to the server may result in one or more asynchronous response messages (a.k.a. events). For example, after the server receives a “set breakpoint” request it may generate an asynchronous response every time that breakpoint is encountered while running the code. The worker threads listen for asynchronous events from the server, package them into course grained messages and send them to the client in much the same way synchronous messages from the server are processed.


Debugging Protocol


In one embodiment, the course grained, asynchronous debugging protocol consists of a series of request and response messages. In one embodiment, the messages implemented by serialized Java objects. Each of these objects contains the information needed to represent the associate request or response. Standard Java serialization rules are used to transmit the Java object over the wire. Using serialized Java objects makes it easy to add new message types to the protocol relatively quickly without having to define new wire formats for each message.


Debugging Message Base Class


In one embodiment, each Java object representing a particular message is derived from a common base class. Therefore, each message shares some common behavior and may inherit default behavior from the base class. One such common base class is described below.

public abstract class weblogic.debugging.packet.DebugPacketimplementsjava.io.SerializableBase class for all debugger communication packets.Constructorspublic DebugPacket( )Methodspublic int getPriority( )Subclasses should override to specify a differentpriorityReturnsDefault priority for all DebugPackets,MEDIUM_PRIORITYpublic boolean overridesLowerPriorityPackets( )Subclasses should override this method if theyoverride lower priority packets that may bequeued for sending.ReturnsDefault - falseFieldspublic static final IMMEDIATE_PRIORITYpublic static final HIGH_PRIORITYpublic static final MEDIUM_PRIORITYpublic static final LOW_PRIORITY


Debugging Message Summary


The following is a list of messages included in the debugging protocol in one embodiment. In one embodiment, each message includes a name, a priority (listed under “Pri”), a yes or no value indicating whether this message overrides lower priority messages previously sent (listed under “Ov”) and optional comments.

Debugging MessagesPriOvCommentsBreakpointHitPacketHighYesSent from proxy to IDE to tell it the VM beingdebugged hit a breakpoint.ClearAllBreakpointsRequestPacketImmediateNoSent from the IDE to the proxy to remove allcurrently set breakpointsClearAllBreakpointsResponsePacketImmediateNoClearBreakpointRequestPacketImmediateNoSent from IDE to proxy to ask to remove analready set breakpointClearBreakpointResponsePacketImmediateNoClearMethodBreakpointPacketMediumNoSent from the IDE to the proxy to tell it toremove a method breakpointDisconnectReconnectPacketHighNoDisconnectRequestPacketImmediateYesDisconnectResponsePacketHighNoDoneStartSetupPacketHighNoDoneStopSetupPacketHighNoExceptionPacketMediumNoExitPacketMediumNoGetBreakpointsRequestPacketMediumNoGetBreakpointsResponsePacketMediumNoGetFieldsRequestPacketMediumNoGetFieldsResponsePacketMediumNoGetStackFramesRequestPacketMediumNoGetStackFramesResponsePacketMediumNoGetThreadsRequestPacketMediumNoGetThreadsResponsePacketMediumNoGetValueRequestPacketMediumNoGetValueResponsePacketMediumNoGetVisibleVariablesRequestPacketMediumNoGetVisibleVariablesResponsePacketMediumNoGoRequestPacketHighYesGoResponsePacketHighYesInitPacketHighYesPausePacketImmediateNoProcessDonePacketLowNoSetBreakpointRequestPacketImmediateNoSent from IDE to proxy to tell it to set abreakpointSetBreakpointResponsePacketImmediateNoSent from the proxy in response to aSetBreakPointRequestPacket from the IDE.SetConditionalBreakpointRequestPacketImmediateNoRequest to set a conditional breakpoint, sentfrom IDE to proxy.SetExceptionBreakpointRequestPacketImmediateNoSetMethodBreakpointRequestPacketMediumNoSent from IDE to proxy to request a breakpointbe set on a methodSetMethodBreakpointResponsePacketMediumNoSent from the proxy to the IDE in response to aSetMethodBreakpointRequestPacketSetPropertiesRequestPacketImmediateNoSetPropertiesResponsePacketImmediateNoSetSmartDebuggingRequestPacketHighNoSetSmartDebuggingResponsePacketHighNoSetupPacketMediumNoSetValueRequestPacketMediumNoSetValueResponsePacketMediumNoStepInPacketHighYesStepOutPacketHighYesStepOverPacketHighYes


Debugging Message Details


This section provides a detailed description of Java classes that could be used to define each of the messages above in one embodiment. Information available in each message is reflected by the fields and methods defined on each class (and its super classes) for accessing that information.

public class weblogic.debugging.packet.ValueResponse implementsjava.io.SerializableConstructorspublic ValueResponse(String variable,String value,String valueType,boolean complex,boolean editable)public ValueResponse(String variable,String value,String valueType,boolean complex,boolean editable,int arrayLength)Methodspublic void setInterfaces(Value val)Fieldspublic_variablepublic_valuepublic_valueTypepublic_complexpublic_editablepublic_staticpublic_syntheticpublic_arrayLengthpublic_interfacespublicclassweblogic.debugging.packet.StepOverPacketextendsweblogic.debugging.packet.DebugPacketConstructorspublic StepOverPacket(long threadId)Methodspublic long getThreadId( )public int getPriority( )public boolean overridesLowerPriorityPackets( )public class weblogic.debugging.packet.StepOutPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic StepOutPacket(long threadId)Methodspublic long getThreadId( )public int getPriority( )public boolean overridesLowerPriorityPackets( )public class weblogic.debugging.packet.StepInPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic StepInPacket(long threadId)Methodspublic long getThreadId( )public int getPriority( )public boolean overridesLowerPriorityPackets( )public class weblogic.debugging.packet.SetValueResponsePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic SetValueResponsePacket(String variable,boolean success,String currentValue)Methodspublic java.lang.String getVariable( )public boolean wasSuccessful( )public java.lang.String getCurrentValue( )public class weblogic.debugging.packet.SetValueRequestPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic SetValueRequestPacket(int frame,long threadId,String variable,String newValue)Methodspublic int getFrame( )public long getThreadId( )public java.lang.String getVariable( )public java.lang.String getNewValue( )public class weblogic.debugging.packet.SetupPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic SetupPacket( )public class weblogic.debugging.packet.SetSmartDebuggingResponsePacketextends weblogic.debugging.packet.DebugPacketConstructorspublic SetSmartDebuggingResponsePacket(boolean enabled)Methodspublic boolean isEnabled( )public int getPriority( )public class weblogic.debugging.packet.SetSmartDebuggingRequestPacketextends weblogic.debugging.packet.DebugPacketConstructorspublic SetSmartDebuggingRequestPacket(boolean enabled)Methodspublic boolean isEnabled( )public int getPriority( )public class weblogic.debugging.packet.SetPropertiesResponsePacketextends weblogic.debugging.packet.DebugPacketConstructorspublic SetPropertiesResponsePacket(String name,String value)Methodspublic java.lang.String getName( )public java.lang.String getValue( )public int getPriority( )public class weblogic.debugging.packet.SetPropertiesRequestPacketextends weblogic.debugging.packet.DebugPacketConstructorspublic SetPropertiesRequestPacket(String name,String value)Methodspublic java.lang.String getName( )public java.lang.String getValue( )public int getPriority( )public classweblogic.debugging.packet.SetMethodBreakpointResponsePacket extendsweblogic.debugging.packet.DebugPacket


Sent from the proxy to the IDE in response to a SetMethodBreakpointRequestPacket

Constructorspublic SetMethodBreakpointResponsePacket(String className,String method,String[ ] params,String status)Methodspublic java.lang.String getClassName( )public java.lang.String getMethod( )public java.lang.String[ ] getParams( )public java.lang.String getStatus( )public classweblogic.debugging.packet.SetMethodBreakpointRequestPacketextends weblogic.debugging.packet.DebugPacket


Sent from IDE to proxy to request a breakpoint be set on a method

Constructorspublic SetMethodBreakpointRequestPacket(String clazz,String method,String[ ] params,int id,String langExt)Methodspublic java.lang.String getClazz( )public java.lang.String getMethod( )public java.lang.String[ ] getParams( )public int getId( )public java.lang.String getLangExt( )public classweblogic.debugging.packet.SetExceptionBreakpointRequestPacketextendsweblogic.debugging.packet.DebugPacketConstructorspublicSetExceptionBreakpointRequestPacket(String exceptionClass,boolean caught,boolean uncaught,int id,String langExt)Methodspublic java.lang.StringgetExceptionClass( )public boolean isCaught( )public boolean isUncaught( )public int getId( )public java.lang.String getLangExt( )public int getPriority( )public java.lang.String toString( )public classweblogic.debugging.packet.SetConditionalBreakpointRequestPacketextendsweblogic.debugging.packet.DebugPacket


Request to set a conditional breakpoint, sent from IDE to proxy. Response comes back as a SetBreakpointResponsePacket, NOT a SetConditionalBreakpointResponsePacket

ConstructorspublicSetConditionalBreakpointRequestPacket(String name,int lineNumber,int id,String condition)Methodspublic java.lang.String getName( )public int getLineNumber( )public int getId( )public java.lang.String getCondition( )public int getPriority( )public classweblogic.debugging.packet.SetBreakpointResponsePacketextends weblogic.debugging.packet.DebugPacket


Sent from the proxy in response to a SetBreakPointRequestPacket from the IDE. Contains information about success/failure to set the breakpoint.

Constructorspublic SetBreakpointResponsePacket(String className,int origLine,int actualLine,String status,int id)Methodspublic java.lang.String getClassName( )public int getOriginalLine( )public int getActualLine( )public java.lang.String getStatus( )public int getId( )public int getPriority( )public class weblogic.debugging.packet.SetBreakpointRequestPacketextends weblogic.debugging.packet.DebugPacket


Sent from IDE to proxy to tell it to set a breakpoint

Constructorspublic SetBreakpointRequestPacket(String name,int lineNumber,Map props,int id,String langExt)Methodspublic java.lang.String getName( )public int getLineNumber( )public int getId( )public java.lang.String getLangExt( )public java.util.Map getProperties( )public int getPriority( )public java.lang.String toString( )public class weblogic.debugging.packet.ProcessDonePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic ProcessDonePacket( )Methodspublic int getPriority( )public class weblogic.debugging.packet.PausePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic PausePacket( )Methodspublic int getPriority( )public java.lang.String toString( )public class weblogic.debugging.packet.NetworkMap implementsjava.io.Serializable


This class holds a map, and makes sure it serializes to a form that makes sense

Constructorspublic NetworkMap(Map m)Methodspublic java.util.Map getMap( )public void setMap(Map m)public class weblogic.debugging.packet.InitPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic InitPacket(int lineNumber,String className,String sourceFile,int id)Methodspublic int getLineNumber( )public java.lang.String getClassName( )public java.lang.String getSourceFile( )public int getId( )public int getPriority( )public boolean overridesLowerPriorityPackets( )public class weblogic.debugging.packet.GoResponsePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GoResponsePacket( )Methodspublic int getPriority( )public boolean overridesLowerPriorityPackets( )public class weblogic.debugging.packet.GoRequestPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GoRequestPacket(long threadId)Methodspublic long getThreadId( )public int getPriority( )public boolean overridesLowerPriorityPackets( )public classweblogic.debugging.packet.GetVisibleVariablesResponsePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GetVisibleVariablesResponsePacket(String[ ] variables,ValueResponse[ ] values)Methodspublic java.lang.String[ ] getVariables( )public weblogic.debugging.packet.ValueResponse[ ] getValues( )public class weblogic.debugging.packet.GetVisibleVariablesRequestPacketextends weblogic.debugging.packet.DebugPacketConstructorspublic GetVisibleVariablesRequestPacket(int frame,long threadId)Methodspublic int getFrame( )public long getThreadId( )public class weblogic.debugging.packet.GetValueResponsePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GetValueResponsePacket(ValueResponse val)public GetValueResponsePacket(String variable,String value,String valueType,boolean complex,boolean editable)public GetValueResponsePacket(String variable,String value,String valueType,boolean complex,boolean editable,int arrayLength)Methodspublic java.lang.String getVariable( )public java.lang.String getValue( )public java.lang.String getValueType( )public boolean isComplex( )public boolean isEditable( )public boolean isArray( )public int getArrayLength( )public java.lang.String toString( )public weblogic.debugging.packet.ValueResponse getValueResponse( )public class weblogic.debugging.packet.GetValueRequestPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GetValueRequestPacket(int frame,long threadId,String variable)Methodspublic int getFrame( )public long getThreadId( )public java.lang.String getVariable( )public java.lang.String toString( )public class weblogic.debugging.packet.GetThreadsResponsePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GetThreadsResponsePacket(long[ ] ids,String[ ] names,StackFrameInfo[ ][ ] callStacks)Methodspublic long[ ] getIds( )public java.lang.String[ ] getNames( )public weblogic.debugging.comm.StackFrameInfo[ ][ ] getCallStacks( )public class weblogic.debugging.packet.GetThreadsRequestPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GetThreadsRequestPacket( )public class weblogic.debugging.packet.GetStackFramesResponsePacketextends weblogic.debugging.packet.DebugPacketConstructorspublic GetStackFramesResponsePacket(StackFrameInfo[ ] stackFrames,long threadId)Methodspublic weblogic.debugging.comm.StackFrameInfo[ ] getStackFrames( )public long getThreadId( )public class weblogic.debugging.packet.GetStackFramesRequestPacketextend weblogic.debugging.packet.DebugPacketConstructorspublic GetStackFramesRequestPacket( )public class weblogic.debugging.packet.GetFieldsResponsePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GetFieldsResponsePacket(String variable,String[ ] fields,ValueResponse[ ] fieldValues)Methodspublic java.lang.String getVariable( )public java.lang.String[ ] getFields( )public weblogic.debugging.packet.ValueResponse[ ] getValues( )public class weblogic.debugging.packet.GetFieldsRequestPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic GetFieldsRequestPacket(int frame,long threadId,String variable)Methodspublic int getFrame( )public long getThreadId( )public java.lang.String getVariable( )public class weblogic.debugging.packet.GetBreakpointsResponsePacketextends weblogic.debugging.packet.DebugPacketConstructorspublic GetBreakpointsResponsePacket(String[ ] breakpoints)Methodspublic java.lang.String[ ] getBreakpoints( )public class weblogic.debugging.packet.GetBreakpointsRequestPacketextends weblogic.debugging.packet.DebugPacketConstructorspublic GetBreakpointsRequestPacket( )public class weblogic.debugging.packet.ExitPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic ExitPacket( )public class weblogic.debugging.packet.ExceptionPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic ExceptionPacket(int lineNumber,String methodName,String fileName,String message,String[ ] stackFrames)Methodspublic int getLineNumber( )public java.lang.String getMethodName( )public java.lang.String getFileName( )public java.lang.String getMessage( )public java.lang.String[ ] getStackFrames( )public class weblogic.debugging.packet.DoneStopSetupPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic DoneStopSetupPacket( )Methodspublic int getPriority( )public class weblogic.debugging.packet.DoneStartSetupPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic DoneStartSetupPacket( )Methodspublic int getPriority( )public class weblogic.debugging.packet.DisconnectResponsePacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic DisconnectResponsePacket( )Methodspublic int getPriority( )public class weblogic.debugging.packet.DisconnectRequestPacket extendsweblogic.debugging.packet.DebugPacketConstructorspublic DisconnectRequestPacket( )Methodspublic int getPriority( )public boolean overridesLowerPriorityPackets( )public class weblogic.debugging.packet.DisconnectReconnectPacketextends weblogic.debugging.packet.DebugPacketConstructorspublic DisconnectReconnectPacket( )Methodspublic int getPriority( )public abstract class weblogic.debugging.packet.DebugPacket implementsjava.io.SerializableBase class for alldebugger communication packets.Constructorspublic DebugPacket( )Methodspublic int getPriority( )Subclasses should override to specify a different priorityReturnsDefault priority for all DebugPackets, MEDIUM_PRIORITYpublic boolean overridesLowerPriorityPackets( )Subclasses should override if they invalidate olddata that may be queued for sending.ReturnsDefault - falseFieldspublic static final IMMEDIATE_PRIORITYpublic static final HIGH_PRIORITYpublic static final MEDIUM_PRIORITYpublic static final LOW_PRIORITYpublicclassweblogic.debugging.packet.ClearMethodBreakpointPacketextends weblogic.debugging.packet.DebugPacket


Sent from the IDE to the proxy to tell it to remove a method breakpoint

Constructorspublic ClearMethodBreakpointPacket( )public classweblogic.debugging.packet.ClearBreakpointResponsePacketextends weblogic.debugging.packet.DebugPacketConstructorspublic ClearBreakpointResponsePacket( )Methodspublic int getPriority( )public classweblogic.debugging.packet.ClearBreakpointRequestPacketextends weblogic.debugging.packet.DebugPacket


Sent from IDE to proxy to ask to remove an already set breakpoint

Constructorspublic ClearBreakpointRequestPacket(String className,int line,int id)Methodspublic int getId( )public java.lang.String getClassName( )public int getLine( )public int getPriority( )Fieldspublic_idpublic_classNamepublic_linepublic classweblogic.debugging.packet.ClearAllBreakpointsResponsePacketextendsweblogic.debugging.packet.DebugPacketConstructorspublic ClearAllBreakpointsResponsePacket( )Methodspublic int getPriority( )public classweblogic.debugging.packet.ClearAllBreakpointsRequestPacketextends weblogic.debugging.packet.DebugPacket


Sent from the IDE to the proxy to remove all currently set breakpoints

Constructorspublic ClearAllBreakpointsRequestPacket( )Methodspublic int getPriority( )public class weblogic.debugging.packet.BreakpointHitPacket extendsweblogic.debugging.packet.DebugPacket


Sent from proxy to IDE to tell it the VM being debugged hit a breakpoint. Includes relevant information that will likely be displayed in the IDE.

Constructorspublic BreakpointHitPacket(int lineNumber,String className,String sourceFile,int id,String message,long threadId)Methodspublic int getLineNumber( )public java.lang.String getClassName( )public java.lang.String getSourceFile( )public int getId( )public int getPriority( )public boolean overridesLowerPriorityPackets( )public java.lang.String getMessage( )public long getThreadId( )public java.lang.String toString( )


Priority Queue


In one embodiment, a debugging proxy can use a priority queue. A priority queue can be implemented using several individual queues, such as one for each available priority. When a new request message arrives from the client, the debugging proxy can examine its priority and places the message on the corresponding queue. If the message is an override message, the debugging proxy can remove all the messages from each queue with a lower priority number than the override message.


Worker threads can process messages with immediate priority first. Then, the threads can begin checking for messages in the queues. Worker threads can check the highest priority queue first. If there is at least one message in the highest priority queue (e.g., HIGH), the worker threads can remove and process the message on the front of that queue. If the highest priority queue is empty, the worker threads can check the next highest priority queue (e.g., MEDIUM). If there is at least one message on the next highest priority queue, the worker threads can remove the message on the front of the queue and process that message. This process can continue in reverse priority order (i.e., highest priority to lowest priority) as long as the debugging proxy is running. If all queues are empty, the worker threads can continue checking starting again with the highest priority queue and working down to the lowest.


In one embodiment, message priorities are assigned statically based on message type. In another embodiment, message priorities may be assigned dynamically based on information that changes at run-time. For example, messages requesting information currently visible in the IDE or that the user has examined frequently may be given higher priority than messages requesting information that is not currently visible or has been accessed less frequently. In this embodiment, the client may be given an API for adjusting the default priorities of some messages.


Debugging Communication Infrastructure


This section contains details of an exemplary communication infrastructure that can be used to send and receive debugging messages in one embodiment. A client can use a AsyncSocketComm class to send requests to and accept responses from the proxy. The proxy may use the PriorityComm class to accept requests from and generate responses back to the client. Requests accepted by PriorityComm may implement the priority scheme described above.


If the proxy is located in the same process space as the debugger on the server, it may use the InProcComm to send requests to and receive responses from the debugger on the server without incurring the cost of network communications. If the proxy is not located on the server, it may use ServerSocketComm to communicate with the server. It may also use ServerSocketCommAsync to communicate with the server e.g. for receiving asynchronous events from the server such as “Hit breakpoint” messages.


Communications Package Summary

Interface SummaryCommTransportThis interface definesthe communicationmethods used.DebugCommandsThe DebugCommandsinterface is theinterface that definesthe debugging commandsgoing from the UIportion of the debugger,to the debug proxy.DebugConstantsThe DebugConstantsinterface is aninterface thatDebugCommands andDebugEvents derivefrom.DebugEventsThe DebugEventsinterface is theinterface thatdefines the debuggingevents that come fromthe proxy to the IDE.IDebuggableLanguageA scripting enginemust implement thisinterface in orderto be able to setitself up to debugin the KNEX framework.IDebuggableLanguage.IBreakpointInfoIDebuggableLanguage.IComplexScriptValueIDebuggableLanguage.IJavaValueIDebuggableLanguage.IOtherLanguageValueIDebuggableLanguage.IScriptArrayValueIDebuggableLanguage.IScriptFrameIDebuggableLanguage.IScriptValueIDebuggableLanguage.ISimpleScriptValueIScriptContextHolderThis interface is usedto get a context objectfor a given frame.IScriptControllerThe script controllerwill be an object thatinteroperates with thescripting languages tobring you script debugging.ServerCommandsThe ServerCommandsinterface is theinterface that definesthe debugging commandsgoing from the KNEXServer to the proxy.ServerEventsThe ServerEventsinterface is theinterface that definesthe debugging eventsthat come from theKNEX Server to the Proxy.


Communications Package Details


This section describes details of the classes, interfaces and exceptions listed above.

public class weblogic.debugging.comm.TransportTimeoutException extendsweblogic.debugging.comm.TransportExceptionConstructorspublic TransportTimeoutException( )public TransportTimeoutException(String str)public TransportTimeoutException(Exception e)publicclassweblogic.debugging.comm.TransportExceptionextendsjava.io.IOException


This is the root exception thrown for transport errors

Constructorspublic TransportException( )public TransportException(String str)public TransportException(Exception e)Methodspublic java.lang.Exception getPreviousException( )Fieldsprotected_epublic class weblogic.debugging.comm.StackFrameInfo implementsjava.io.Serializable


Simple data holder for a stack frame in the VM that's being debugged

Constructorspublic StackFrameInfo(String className,String sourceName,String methodName,int lineNumber,int frameIndex)Methodspublic java.lang.String getClassName( )public java.lang.String getSourceName( )public java.lang.String getMethodName( )public int getLineNumber( )public int getFrameIndex( )public java.lang.String[ ] getVariables(ThreadReference tr,Object sfh)public ObjectReference getThis(ThreadReference tr,Object sfh)Fieldsprotected_classNameprotected_sourceNameprotected_methodNameprotected_lineNumberprotected_javaFrameIndexpublic class weblogic.debugging.comm.SocketCommExceptionextendsweblogic.debugging.comm.TransportExceptionConstructorspublic SocketCommException( )public SocketCommException(String s)public SocketCommException(Exception e)publicclassweblogic.debugging.comm.SocketCommimplementsweblogic.debugging.comm.CommTransport


SocketComm is Transport class that will transport over TCP

Constructorspublic SocketComm( )Methodspublic void accept(ServerSocket ss)If this SocketComm is being used on a serversocket, this method will wait until aclient opensa connection with it. Then it will initializethis class to send and recive off of that socket.public void attach(String serverName,int socketNum)If this SocketComm is initiating communication withanother process, this method will attachto the other process and initialize the SocketCommto start to send a recieve off that socket.protected boolean isPacketAvailable( )public weblogic.debugging.packet.DebugPacketgetPacket( )public weblogic.debugging.packet.DebugPacketgetPacket(int timeout)public void sendPacket(DebugPacket packet)public void close( )public java.net.Socket getSocket( )protected final boolean Log(String str)public classweblogic.debugging.comm.ServerSocketCommAsyncimplementsweblogic.debugging.comm.CommTransport, java.lang.Runnable


ServerSocketCommAsync is a class that will use a SocketComm for sending and receiving requests, but has another thread that is doing the actual sends/receives and queuing them to a buffer. This other thread will hang out and wait on a ServerSocket, until it can party on that socket.

Constructorspublic ServerSocketCommAsync( )Methodspublic void setServerSocket(ServerSocket ssT)If this SocketComm is being used on a serversocket, this method will wait until a clientopensa connection with it. Then it will initialize thisclass to send and recive off of that socket.public weblogic.debugging.packet.DebugPacketgetPacket(int timeout)public void sendPacket(DebugPacket packet)public void reset( )public void close( )public void run( )public weblogic.debugging.packet.DebugPacketgetPacket( )publicclassweblogic.debugging.comm.ServerSocketCommimplementsweblogic.debugging.comm.CommTransport


ServerSocketCommAsync is a class that will use a SocketComm for sending and reciving requests, but has another thread that is doing the actual sends/recieves and queuing them to a buffer. This other thread will hang out and wait on a ServerSocket, until it can party on that socekt.

Constructorspublic ServerSocketComm( )Methodspublic void setServerSocket(ServerSocket ssT)If this SocketComm is being used on a server socket,this method will wait until a client opensa connection with it. Then it will initialize thisclass to send and recive off of that socket.public weblogic.debugging.comm.SocketCommgetSocketComm( )public void accept( )public weblogic.debugging.packet.DebugPacketgetPacket(int timeout)public void sendPacket(DebugPacket packet)public void reset(boolean fClose)public void close( )public weblogic.debugging.packet.DebugPacketgetPacket( )public interface weblogic.debugging.comm.ServerEvents


The ServerEvents interface is the interface that defines the debugging events that come from the KNEX Server to the Proxy. This will also define the events that come from the different languages to the Proxy. These same interfaces will be used to talk from the Proxy to the different languages.

Methodspublic void initDone( )public void requestLanguagePacket( )requests information about the languages currentlyloaded on the server.public void pushRequestDone( )sends a message to the script engine saying we'veprocessed it's request.publicclassweblogic.debugging.comm.ServerControllerimplementsweblogic.debugging.comm.ServerCommands,weblogic.debugging.comm.ServerEvents


The ServerController is the major piece of code that goes between the proxy and the KNEX server. This code will be shared by the

Constructorspublic ServerController(CommTransport transport)Methodspublic weblogic.debugging.comm.CommTransport setTransport(CommTransport transport)public void close( )public void processNextEvent(ServerEvents serverEvents)public void init(String serverName,boolean fNeedsResponse)public void operationDone( )public void shutdown( )public void scriptStart( )public void scriptStop( )public void processNextCommand(ServerCommands serverCommands)processNextCommand will get the next command from theCommTransport, and call into theappropriate function in the Server's DebugCommands interface.This is called by the DebugEngine code.public static void processCommand(DebugPacket packet,ServerCommands serverCommands)public void initDone( )public void pushRequestDone( )public void requestLanguagePacket( )requests information about the languages currently loaded on the server.publicclassweblogic.debugging.comm.ServerConnectInfoextendsweblogic.debugging.comm.ConnectInfogroks all the info about creating a connection from the proxy to the KNEX Server.Constructorspublic ServerConnectInfo( )Methodspublic void processCmdLineArgs(String[ ] args)public weblogic.debugging.comm.CommTransport createTransport( )public weblogic.debugging.comm.CommTransport createClientTransport( )public void printUsage1(StringBuffer buff)Prints the Commandline params we understand here. This willonly print the usage thatshould appear on the first line of the usage. param buff --This is the string buffer to appendusage info into.public void printUsage2(StringBuffer buff)Prints the Commandline params we understand here. This willonly print the usage thatshould appear in the body of the usage. param buff --This is the string buffer to appendusage info into.Fieldspublic static final default Portpublic interface weblogic.debugging.comm.ServerCommands implementsweblogic.debugging.comm.DebugConstants


The ServerCommands interface is the interface that defines the debugging commands going from the KNEX Server to the proxy. These same interfaces will be used to talk from the Proxy to the different languages.

Methodspublic void init(String serverName,boolean fNeedsResponse)Sends an initialization packet to the proxy.public void operationDone( )Sends a message telling the proxy the current web operationhas completed. There may verypossibly be another operation in the process ofcompleting at this point.public void shutdown( )Sends a message to the proxy telling it to shut itself down.This is not the same thing asdetaching for the Server, this will actually close the process.public void scriptStart( )public void scriptStop( )publicclassweblogic.debugging.comm.ScriptStackFrameInfoextendsweblogic.debugging.comm.StackFrameInfo


This holds the proper stack information for a stack that is translated from script

Constructorspublic ScriptStackFrameInfo(String className,String sourceName,String methodName,int lineNumber,String langExt,ObjectReference contextObject,int stackIndex,int javaStackIndex,ProxyScriptEngine pse)Methodspublic ObjectReference getContextObject( )public java.lang.String getLanguageExtension( )public int getStackIndex( )public void setServerInfo(ArrayReference a)public java.lang.String[ ] getVariables(ThreadReference tr,Object sfhObj)public ObjectReference getThis(ThreadReference tr,Object sfhObj)public Value getLocalVariable(String name,ThreadReference tr)public Value setVariable(String name,String strNewVal,ThreadReference tr)publicclassweblogic.debugging.comm.PriorityQueueextendsweblogic.debugging.utils.SynchQueueMethodspublic synchronized java.lang.Object getObject(int timeout)public synchronized void putObject(Object o,int priority,boolean clearLesser)public synchronized java.lang.Object[ ] getAllObjects( )This gets all the Objects in the array that are notalready promised to a waiter and returnsthem in an Array. Note, that this will take thehighest priority bunch, which means that if youcall this while other threads are using the Queue,this call will tend to get the high priorityitems rather than the other threads.publicclassweblogic.debugging.comm.PriorityCommextendsweblogic.debugging.comm.AsyncCommBase


This class wraps other CommTransports, then when a message comes in off another transport, this will check it's priority, and if the priority is the highest, it will execute it immediately. Otherwise, it will pass it along like normal. NOTE: Although this extends AsyncSocketComm, it does not have to communicate via Sockets

Methodsprotected void processInput(DebugPacket packet)publicclassweblogic.debugging.comm.JspStackFrameInfoextendsweblogic.debugging.comm.JavaStackFrameInfoConstructorspublic JspStackFrameInfo(String className,String methodName,int lineNumber,int javaFrameIndex,Notify notify,ThreadReference thread)Methodspublic java.lang.String getSourceName( )public void setCorrectedFrameIndex(int i)publicclassweblogic.debugging.comm.JavaStackFrameInfoextendsweblogic.debugging.comm.StackFrameInfo


Simple data holder for a stack frame in the VM that's being debugged

Constructorspublic JavaStackFrameInfo(String className,String sourceName,String methodName,int lineNumber,int javaFrameIndex)Methodspublic java.lang.String[ ] getVariables(ThreadReference tr,Object sfh)public ObjectReference getThis(ThreadReference tr,Object sfh)public interface weblogic.debugging.comm.IScriptController


The script controller will be an object that interoperates with the scripting languages to bring you script debugging. The way this will work is each language engine will have an instance of the IScriptController, and the IScriptController will have list of all the IDebuggableLanguage interfaces.

Methodspublic weblogic.debugging.comm.IScriptController.LanguageInfo[ ] getLanguages( )returns a list that contains LanguageInfo. There will be one for each language.public int Break( )This is what a running script will call when it wants to break. This is a waiting call, that will notreturn until the thread has been told to continue. The frames parameter should be a list ofIDebuggableLanguage$IScriptFrame .Parametersframes - - should be the frame list for the current script context.Returnsthe return value tells the scripting engine what command resumed the break.public int Pause(int pauseID)this is what the scripting lanuguage calls when it's time to pause itself.Returnsthe return value tells the scripting engine what command resumed the pause.public boolean StartScript( )This is what a script engine must call when starting execution. This is how the engine willknow if the thread is currently in the middle of a step or not.Returnsthe return value tells the scripting engine what kind of execution we are in the middleof.public boolean ResumeScript( )This is what a script engine must call when resuming execution. This is how the engine willknow if the thread is currently in the middle of a step or not.Returnsthe return value tells the scripting engine what kind of execution we are in the middleof.public weblogic.debugging.comm.IDebuggableLanguage.IScriptValueprocessScriptValue(IDebuggableLanguage.IScriptValue value)processes an IScriptValue by passingit off to the script engine that knows about it, then it willreturn a new IScritpValue that knows more about that value.public void breakpointProcessed(IDebuggableLanguage.IBreakpointInfo bpi)This tells the script controller that a breakpoint that was previously un-resolvable has nowbeen resolved.public weblogic.debugging.comm.IDebuggableLanguage.IScriptFrame[ ] getStack(String langExt,Object context)This gets the stack frames for the script language specified, using the context specified.ParameterslangExt - -- This is the language extension for the language we are inspecting.context - -- This is the language context we are investigating.Returnsan array of the stackframes this yeilds.Fieldspublic static final RESUME_CONTINUEpublic static final RESUME_STEP_INpublic static final RESUME_STEP_OUTpublic static final RESUME_STEP_OVERpublic static final RESUME_STOPpublic static classweblogic.debugging.comm.IScriptController.LanguageInfo implementsjava.io.SerializableConstructorspublic IScriptController.LanguageInfo(String languageName,String[ ] languageExtensions,String[ ] languageFilters,String[ ] contextHolders)Fieldspublic final_languageNamepublic final_languageExtensionspublic final_languageFilterspublic final_contextHolderspublic transient_langpublic interface weblogic.debugging.comm.IScriptContextHolder


This interface is used to get a context object for a given frame. The way this will work is that the Proxy will go down the stack frame, looking for objects that derive from IScriptContextHolder. When it comes across such a class, it will get the context from the frame and pass it to the DebugScriptController. It is possible for many script frames to all have the same context. In this case, the frame will only get passed to the DebugScriptController once.

Methodspublic java.lang.Object getContext( )public class weblogic.debugging.comm.InProcMediumConstructorspublic InProcMedium( )Methodspublic void close( )publicclassweblogic.debugging.comm.InProcCommimplementsweblogic.debugging.comm.CommTransportConstructorspublic InProcComm(SynchQueue in,SynchQueue out)Methodspublic weblogic.debugging.packetDebug.PacketgetPacket(int timeout)public void sendPacket(DebugPacket packet)public void close( )public weblogic.debugging.packetDebug.PacketgetPacket( )protected final boolean Log(String str)public interface weblogic.debugging.comm.IDebuggableLanguage


A scripting engine must implement this interface in order to be able to set itself up to debug in the KNEX framework.

Methodspublic void exit( )This will be called when we are ending.Problem is that this will not get called in the case ofsystem crashes, etc.public java.lang.String[ ] LanguageFilters( )This is a list of the classes we should filter to preventfrom showing up in the stack. You willbe able to use wild cards, such as org.mozilla.rhino.*public java.lang.String[ ] ContextHolders( )This is a list of the class instances that we can get ascript context from.public java.lang.String LanguageName( )This is a list of the class instances that we can call intoto get variable information, etc. Whenwalking through a stack trace, we will go to each of theseto ask it to spit out it's stack. We willfurthermore. When a user inspects this part of the stack,we will also ask these objects forvariable values, etc.public java.lang.String[ ] LanguageExtensions( )This is a list of the class instances that we can call intoto get variable information, etc. Whenwalking through a stack trace, we will go to each of theseto ask it to spit out it's stack. We willfurthermore. When a user inspects this part of the stack,we will also ask these objects forvariable values, etc.public boolean featureEnabled(String feature)This function is used for determining what features thisdebug engine supports.public boolean pause(Object context,int pauseID)When pause is called, it is up to the script engine to breakat the next possible place. Thismethod can be called while the engine is in teh middle ofprocessing, so should be treated asa synchronized.public weblogic.debugging.comm.IDebuggableLanguage.IScriptValue getVariable(Object context,String strVar,int stackFrame)public void setVariable(Object context,String strVar,IDebuggableLanguage.IScriptValue value,int stackFrame)public weblogic.debugging.comm.IDebuggableLanguage.IScriptValue processValue(IDebuggableLanguage.IScriptValue value)publicweblogic.debugging.comm.IDebuggableLanguage.IScriptValueprocessExpression(Object context,String strExpr,int stackFrame)public weblogic.debugging.comm.IDebuggableLanguage.IScriptFrame[ ] getStack(Object context)publicweblogic.debugging.comm.IDebuggableLanguage.IBreakpointInfosetSourceBreakpoint(String clazz,int line,int id)publicweblogic.debugging.comm.IDebuggableLanguage.IBreakpointInfosetMethodBreakpoint(String clazz,String method,String[ ] params,int id)publicweblogic.debugging.comm.IDebuggableLanguage.IBreakpointInfosetWatchpoint(String clazz,String varName,boolean fStopOnRead,boolean fStopOnWrite,int id)public void clearBreakpoint(int id)public void clearAllBreakpoints( )Fieldspublic static final EXPRESSION_SUPPORTpublic static final SOURCE_BREAKPOINT_SUPPORTpublic static final METHOD_BREAKPOINT_SUPPORTpublic static final WATCH_POINT_SUPPORTpublic static final INVALID_PAUSEIDpublic static interfaceweblogic.debugging.comm.IDebuggableLanguage.IScriptValueMethodspublic java.lang.String getValue( )This gets the value we should display to the user.public java.lang.String getTypeName( )If this is a language that supports types, this should return the type name of this variable.public void setValue(String val)This is the value the user typed in, it's up to the scriptengine to turn this into a value.public int getAbstractType( )This determines if the variable is a complex type, simple type or other languagy type.Fieldspublic static final SIMPLE_TYPEpublic static final COMPLEX_TYPEpublic static final SCRIPT_ARRAY_TYPEpublic static final OTHER_LANGUAGE_TYPEpublic static final JAVA_LANGUAGE_TYPEpublic static interfaceweblogic.debugging.comm.IDebuggableLanguage.ISimpleScriptValueimplements weblogic.debugging.comm.IDebuggableLanguage.IScriptValueMethodspublic int getPrimativeType( )public boolean getBoolean( )public byte getByte( )public char getChar( )public double getDouble( )public float getFloat( )public int getInt( )public long getLong( )public short getShort( )public java.lang.String getString( )Fieldspublic static final TYPE_BOOLEANpublic static final TYPE_BYTEpublic static final TYPE_CHARpublic static final TYPE_DOUBLEpublic static final TYPE_FLOATpublic static final TYPE_INTpublic static final TYPE_LONGpublic static final TYPE_SHORTpublic static final TYPE_STRINGpublic static final TYPE_NULLpublic static interfaceweblogic.debugging.comm.IDebuggableLanguage.IScriptArrayValueimplements weblogic.debugging.comm.IDebuggableLanguage.IScriptValueMethodspublic int getLength( )public weblogic.debugging.comm.IDebuggableLanguage.IScriptValue getElement(int i)public static interfaceweblogic.debugging.comm.IDebuggableLanguage.IComplexScriptValueimplements weblogic.debugging.comm.IDebuggableLanguage.IScriptValueMethodspublic java.util.List getMembers( )if this is a complex type, this will return a list of all it's members.public weblogic.debugging.comm.IDebuggableLanguage.IScriptValue getMember(String name)if this is a complex type, this will return a member of it.public void setMember(String name,IDebuggableLanguage. IScriptValue val)if this is a complex type, this will return a member of it.public weblogic.debugging.comm.IDebuggableLanguage.IScriptValue callMethod(String name,IDebuggableLanguage.IScriptValue[ ] values)calls a method on the comlex type. If the method is a voidmethod, it should return a null.Otherwise, callMethod should return a scriptValue representingthe returned value. If thatvalue is null, this will be a ScriptValue with the value null.public static interfaceweblogic.debugging.comm.IDebuggableLanguage.IOtherLanguageValueimplements weblogic.debugging.comm.IDebuggableLanguage.IScriptValueMethodspublic java.lang.String getScriptExtension( )script extension for this variable.public java.lang.Object getValueObject( )gets the underlying value object. The other scripting language should be able to figure outwhat this is to be able to create one of the other Script values from this.public static interfaceweblogic.debugging.comm.IDebuggableLanguage.IJavaValueimplementsweblogic.debugging.comm.IDebuggableLanguage.IScriptValueMethodspublic java.lang.Object getValueObject( )gets the underlying java object. The proxy will be able to disect this and keep values, etc forthis.public static interfaceweblogic.debugging.comm.IDebuggableLanguage.IScriptFrameMethodspublic java.lang.String getLanguageExtension( )This will get the file extension specifying what language this is. If a language supports morethan one file extension, this will just be one.public java.lang.String getFunctionName( )If this returns non-null, this string will be used to display the stack frame to the user.public java.lang.String getClassName( )This is the class name that we will derive the file from. This will be put through the documentresolution process on the ide.public java.lang.String getFileName( )This is the class name that we will derive the file from. This will be put through the documentresolution process on the ide.public int getLine( )This is the line of execution the current frame is on.public java.util.List getFrameVariables( )This function will return an array of all the values visible from the current stack. All the valuesin the list that are returned will be of type Strong. To get a value, you will want to callIDebuggableLanguage.getVariablepublic weblogic.debugging.comm.IDebuggableLanguage.IScriptValue getThis( )This function will return an IScriptValue if there is a this object, otherwise it will return null.public static interfaceweblogic.debugging.comm.IDebuggableLanguage.IBreakpointInfoMethodspublic java.lang.String getStatus( )public int getOrigLine( )public int getCurrLine( )public int getId( )Fieldspublic static final BREAKPOINT_RESOLVEDpublic static final BREAKPOINT_UNRESOLVEDpublic static final BREAKPOINT_ERRORpublic class weblogic.debugging.comm.DisconnectReconnectExceptionextends weblogic.debugging.comm.TransportExceptionConstructorspublic DisconnectReconnectException( )publicclassweblogic.debugging.comm.DebugKillExceptionextendsjava.lang.Throwable


This is an exception that can be used to kill threads in Weblogic

Constructorspublic DebugKillException( )public class weblogic.debugging.comm.DebugInfo


This class keeps track of the info we need to be able to attach to JDI on another process.

Constructorspublic DebugInfo(String server,int port)public DebugInfo(String MapName)public DebugInfo(ListeningConnector listener,String address)Methodspublic void processCmdLineArgs(String[ ] args)public void printUsage1(StringBuffer buff)Prints the Commandline params we understand here.This will only print the usage thatshould appear on the first line of the usage. parambuff -- This is the string buffer to appendusage info into.public void printUsage2(StringBuffer buff)Prints the Commandline params we understand here.This will only print the usage thatshould appear in the body of the usage. parambuff -- This is the string buffer to appendusage info into.public void setMaxRetries(int retries)public static synchronized java.lang.StringgetNewMapName( )public static synchronized int getNewPort( )public java.lang.String getTransportType( )public int getPort( )public java.lang.String getMapName( )public java.lang.String getDebugArguments( )This function will get the Debug Commandlinearguements needed to start a Java VMpublic VirtualMachine AttachToVm( )Fieldspublic static final KEYpublic static final DefaultServerpublic static final DefaultPortpublic static SharedMemorypublic static Socketspublic static ListeningConnectorpublic static PassedVMprotected static baseTempprotected static baseCounterprotected static lastPortprotected transportTypeprotected portprotected serverprotected listenerprotected vmpublic interface weblogic.debugging.comm.DebugEvents


The DebugEvents interface is the interface that defines the debugging events that come from the proxy to the IDE. This will also define the events that come from the different languages to the Proxy. These same interfaces will be used to talk from the Proxy to the different languages

Methodspublic void setup( )public void exit( )public void breakHit(int lineNumber,String className,String sourceFile,int id,String message,long threadId)public void processDone( )public void getValueDone(ValueResponse value)public void setValueDone(String variable,boolean success,String currentValue)public void requestFieldsDone(String variable,String[ ] fields,ValueResponse[ ] fieldValues)public void requestBreakpointsDone(String[ ] breakpoints)public void requestStackFramesDone(StackFrameInfo[ ] frames,long threadId)public void requestVisibleVariablesDone(String[ ] variables,ValueResponse[ ] values)public void goDone( )public void setBreakpointDone(String className,int origLine,int actualLine,String status,int id)public void breakMethodResolved(String className,String method,String[ ] params,String status)public void clearBreakpointDone( )public void smartDebuggingDone(boolean fOn)public void clearAllBreakpointsDone( )public void disconnectDone( )public void disconnectReconnect( )public void getThreadsDone(long[ ] ids,String[ ] names,StackFrameInfo[ ][ ] callStacks)public void setPropertyDone(String prop,String value)Fieldspublic static final NOT_ARRAYArray length value to indicate that the value is not an arraypublic class weblogic.debugging.comm.DebugController implementsweblogic.debugging.comm.DebugCommands,weblogic.debugging.comm.DebugEvents


A DebugController is a major piece of code that can go between the client and the server. Both sides can go through the DebugController to send debugging messages. The DebugController will then pass the appropriate commands to the appropriate DebugController via the CommTransport that is provided.

Constructorspublic DebugController(CommTransport transport)Methodspublic weblogic.debugging.comm.CommTransportsetTransport(CommTransport transport)public void close( )public void processNextEvent(DebugEvents debugEvents)public void clearAllBreakpoints( )public void clearBreakpoint(String className,int line,int id)public void disconnect( )public void doneStartSetup( )public void doneStopSetup( )public void getValue(int frame,long threadId,String variable)public void requestBreakpoints( )public void requestFields(int frame,long threadId,String variable)public void requestStackFrames( )public void requestThreads( )public void requestVisibleVariables(int frame,long threadId)public void run(long threadId)public void setBreakpoint(String name,int lineNumber,Map props,int id,String langExt)public void set Method Breakpoint(String clazz,String method,String[ ] params,int id,String langExt)public void setExceptionBreakpoint(String exceptionClass,boolean caught,boolean uncaught,int id,String langExt)public void setValue(int frame,long threadId,String variable,String newValue)public void smartDebugging(boolean fOn)public void stepIn(long threadId)public void stepOut(long threadId)public void stepOver(long threadId)public void pause( )public void setProperty(String prop,String value)public boolean processNextCommand(DebugCommands debugCommands,int timeout)processNextCommand will get the next command fromthe CommTransport, and call into theappropriate function in the Server's DebugCommandsinterface. This is called by the DebugEngine code.Returnstrue if there was a JDI event to process,false if there wasn't anything. Useful so thecaller can avoid busy waiting by doing a sleep ifthere wasn't anything waiting on any of thequeues from which it consumespublic static void processCommand(DebugPacket packet,DebugCommands debugCommands)public void init(int lineNumber,String className,String sourceFile,int id)public void breakHit(int lineNumber,String className,String sourceFile,int id,String message,long threadId)public void exit( )public void setup( )public void breakMethodResolved(String className,String method,String[ ] params,String status)public void clearAllBreakpointsDone( )public void clearBreakpointDone( )public void disconnectDone( )public void disconnectReconnect( )public void getValueDone(ValueResponse value)public void goDone( )public void processDone( )public void requestBreakpointsDone(String[ ] breakpoints)public void requestFieldsDone(String variable,String[ ] fields,ValueResponse[ ] fieldValues)public void requestStackFramesDone(StackFrameInfo[ ] frames,long threadId)public void requestVisibleVariablesDone(String[ ] variables,ValueResponse[ ] values)public void setBreakpointDone(String className,int origLine,int actualLine,String status,int id)public void setValueDone(String variable,boolean success,String currentValue)public void smartDebuggingDone(boolean fOn)public void getThreadsDone(long[ ] ids,String[ ] names,StackFrameInfo[ ][ ] callStacks)public void setPropertyDone(String prop,String value)public interface weblogic.debugging.comm.DebugConstants


The DebugConstants interface is an interface that DebugCommands and DebugEvents derive from. This interface only defines constants that are used for defining the commands.

Fieldspublic static final PAUSEpublic static final KILLpublic static final BREAKPOINT_RESOLVEDpublic static final BREAKPOINT_UNRESOLVEDpublic static final BREAKPOINT_ERRORpublic static final DebugSocketpublic static final DebugInteruptSocketpublic static final JWS_DEBUGCONTEXTpublic static final JWS_STARTCONTEXTpublic static final JWS_ENDCONTEXTpublic static final BP_PROP_CONDITIONpublic interface weblogic.debugging.comm.DebugCommandsimplementsweblogic.debugging.comm.DebugConstants


The DebugCommands interface is the interface that defines the debugging commands going from the UI portion of the debugger, to the debug proxy. The second half of this is the DebugEvents interface, which defines all the events that are sent from the debugger, to the IDE. These same interfaces will be used to talk from the Proxy to the different languages.

Methodspublic void doneStartSetup( )public void doneStopSetup( )public void disconnect( )public void run(long threadId)public void stepIn(long threadId)public void stepOver(long threadId)public void stepOut(long threadId)public void setBreakpoint(String name,int lineNumber,Map properties,int id,String langExt)public void setMethodBreakpoint(String clazz,String method,String[ ] params,int id,String langExt)public void setExceptionBreakpoint(String exceptionClass,boolean caught,boolean uncaught,int id,String langExt)public void clearBreakpoint(String className,int line,int id)public void clearAllBreakpoints( )public void requestBreakpoints( )public void getValue(int frame,long threadId,String variable)public void setValue(int frame,long threadId,String variable,String newValue)public void requestStackFrames( )public void requestThreads( )public void requestVisibleVariables(int frame,long threadId)public void requestFields(int frame,long threadId,String variable)public void smartDebugging(boolean fOn)public void pause( )public void setProperty(String prop,String value)publicclassweblogic.debugging.comm.DbgCtrlSocketExceptionextendsweblogic.debugging.comm.TransportExceptionConstructorspublic DbgCtrlSocketException( )public DbgCtrlSocketException(String s)public DbgCtrlSocketException(Exception e)Methodspublic java.lang.Exception getPreviousException( )public class weblogic.debugging.comm.ConnectInfoConstructorspublic ConnectInfo(String server,int port,int connectType)public ConnectInfo(InProcMedium medium,int connectType)public ConnectInfo(ServerSocket ss,int connectType)Methodspublic void setWrap(int wrapType,Object wrapObj)public weblogic.debugging.comm.CommTransportcreateTransport( )public void close( )Fieldsprotected_connectTypeprotected_wrapTypeprotected_portprotected_objprotected_wrapobjpublic static final connectSocketpublic static final connectSocketAsyncpublic static final connectServerSocketAsyncpublic static final connectSameProcessServerpublic static final connectSameProcessClientpublic static final connectServerSocketpublic static final noWrappublic static final asyncWrappublic static final priorityWrappublic interface weblogic.debugging.comm.CommTransport


This interface defines the communication methods used.

Methodspublic void sendPacket(DebugPacket packet)public weblogic.debugging.packet.DebugPacketgetPacket( )public weblogic.debugging.packet.DebugPacketgetPacket(int timeout)public void close( )publicclassweblogic.debugging.comm.AsyncSocketCommextendsweblogic.debugging.comm.AsyncCommBase


AsyncSocketComm is a class that will use a SocketComm for sending and recievine requests, but has another thread that is doing the actual sends/receives and queuing them to a buffer.

Constructorspublic AsyncSocketComm( )publicclassweblogic.debugging.comm.AsyncCommBaseimplementsweblogic.debugging.comm.CommTransport


This class wraps a CommTransport, and adds a level of indirection to make the network communications non-dependant on the message processing.

Constructorsprotected AsyncCommBase(CommTransport transport)Methodspublic weblogic.debugging.comm.CommTransportgetTransport( )public weblogic.debugging.packet.DebugPacketgetPacket(int timeout)public weblogic.debugging.packet.DebugPacketgetPacket( )public void sendPacket(DebugPacket packet)public void close( )protected void processInput(DebugPacket packet)protected void processOutput(DebugPacket packet)Fieldsprotected_transportprotected volatile_errorprotected_workerprotected_worker2protected_inputQueueprotected_outputQueue


The foregoing description of preferred embodiments of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations will be apparent to one of ordinary skill in the art. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others skilled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalence.

Claims
  • 1. A method for the improved debugging of software code, comprising: providing a debugging proxy adapted to manage communication between a client and a debugging component; and providing a debugging protocol that can be used by the debugging proxy to manage communication.
  • 2. A method according to claim 1, wherein: the debugging protocol allows for asynchronous messaging.
  • 3. A method according to claim 1, wherein: the debugging protocol allows for the communication of large grain messages.
  • 4. A method according to claim 1, wherein: the debugging protocol implements a priority scheme for priority-based communication processing.
CLAIM TO PRIORITY

The present application claims the benefit of priority under 35 U.S.C. §119(e) to U.S. Provisional Patent Application entitled “SYSTEMS AND METHODS UTILIZING A DEBUGGING PROXY”, Application No. 60/450,383, filed on Feb. 27, 2003, which application is incorporated herein by reference.

Provisional Applications (1)
Number Date Country
60450383 Feb 2003 US