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.
The present invention relates to the debugging of software and software components.
Most real-world software systems of any significant complexity are written in more than one programming language. For example, an environment may be implemented in Java while an interpreted language may be running on top of Java and need to be debugged. This situation creates significant difficulties for software developers attempting to debug these systems. This problem is complicated by the fact that there is no standardization in terms of internal structures, such as stack frames, between different programming languages. For example, it is not uncommon for a developer to see stack information not directly related to the software being debugged when encountering a stack frame for one language, when using a debugger intended for another language. As another example, when using a debugger intended for the Java language, a Java stack will not include the XScript (a JavaScript variant with native support for XML) stack, and can sometimes show the set of Java classes that implement the XScript engine (these are part of the environment, but not the software the developer is working on). One multi-language debugger, JSR 45, can only be used to debug languages that are easily transformed into Java and then compiled. This and most other multi-language debuggers won't work with languages such as XScript that where the language will be run by an interpreter or the language can not be mapped directly to Java because, for example, the language has a different data structure. Thus, creating debugging tools that can be applied to software applied to more than one programming language, and running in the same environment, has proved to be extremely difficult.
Methods for a debugging environment that can be used by software developers working on multi-language systems. The techniques used create a debugging environment that can be uniform across languages, and can seamlessly perform debugging between one or more languages in a multi-language environment. Such a system can have a number of attributes intended to help developers facing debugging problems in multi-language environments.
Systems and methods in accordance with embodiments of the present invention provide a debugging environment that can be used by software developers working on multi-language systems. The techniques used create a debugging environment that can be uniform across languages, and can seamlessly perform debugging between one or more languages in a multi-language environment. Such a system can have a number of attributes intended to help developers facing debugging problems in multi-language environments including:
Each language integrated into a multi-language debugger can include specific support for the stack frame structures and variable representations used in that language. Each new language added to the multi-language debugger can extend the system in at least one of 3 areas:
Throughout the following discussion, an example is developed using the Java language. It will be understood that the invention is equally applicable to any programming language. This example is presented for illustrative purposes only and is not meant to limit the scope, functionality or spirit of any particular embodiment of the invention.
Architectural Overview
Some embodiments will be comprised of one or more functional components or modules. It will be understood that any particular embodiment of the invention may not require all of the components listed, may use additional components, or may use an entirely different organization without changing the functionality, scope or spirit. Components used in some embodiments can include:
In some embodiments, when the runtime-messaging infrastructure is started in non-production (debug) mode, a script controller for the debug process is started. This object inspects the system for script engines, and loads them and their configuration information.
In some embodiments when the runtime-messaging infrastructure starts a debugging session, it will send a message to the proxy. Typically, this message includes a list of languages and language configuration information for the languages supported by the multi-language debugger. In some embodiments, when debugging begins, the debug proxy will talk to the script controller for control flow (e.g. step, continue, pause), and will operate directly on the script engines for debugging information (e.g. stack frames, variable inspection, expressions).
In some embodiments, after the script engines have all registered themselves, the script debug controller waits until debugging is started.
In some embodiments, when a breakpoint is hit, or a step is finished in communications with the script engine will be to the script debug controller. As an example, with Java code, all communications with the script engines will be through JDI calls to the script debug controller.
In some embodiments, the first breakpoint hit in the underling language can behave like a normal break. The following process may then occur:
1. The debugger gets the current class, line, and stack and processes the stack through a language filter. If during processing, the debugger encounters a class that implements a script language the following steps may be take: a) if the object derives from a context holder, the debug script controller makes a method call to get the context, and b) the debug script controller will call a method to get the contents of the stack. Continuing the examples for the Java language, the debug script controller will call getcontext (or some other suitable named method) on the IcontextHolder object to get the context and then calls a method ScriptDebugController.getStack(LanguageExt, Context) (or some other suitable named method) via JDI, to get a list of scriptFrames.
In some embodiments, the following process may occur if the current stack frame is set to a frame controlled by a script engine:
2. For each object queried, call a method to get the values of the script variables. Continuing the example for the Java language, a call is made to IDebuggableLanguage.getVariable( ) (or some other suitable named method), to get the IScriptVariable (or some other suitable named interface)value. Some possible Java language examples of the results of this operation can be seen in the following table.
Stepping through Code
Some embodiments can step though code using a mechanism analogous to that used in an ordinary (without multi-language support) debugger, except that the debugger will inform the script debug controller when a step is about to begin. In this way, any script engine that is started, and script engines that return from calling into the underling language (e.g. Java) will be able to stop appropriately. In some cases, script implementation classes are placed into the excludes-filter during a step request.
Continuing
In some embodiments this operation behaves like a continue in an ordinary (not multi-language) debugger.
Script Breakpoint Hit
In some embodiments, when a script breakpoint is hit the following actions can occur:
In some embodiments, when the user hits Pause, the thread will be paused. The debugger can then look to see if the stack is currently in scripting or the underling language (e.g. Java) code. One of the following actions may then be taken:
In some embodiments, information in breakpoint packets can use a suitable extension or other indicator to identify the language type being executed. In some cases, the absence of the extension can indicate the underling language (e.g. Java) is being used. If a breakpoint is not in the underling language the following actions may be taken:
In some embodiments several types of breakpoints are supported, which can include:
It should be noted, that depending on the details of the embodiment, any language may be able to support a sub-set of the available breakpoint types for any given language. Returning a true or false to a query for that type can indicate the support for a particular breakpoint type. For example, a true or false can be returned for a method, featureEnabledo (or some other suitable name), when called with a variable indicating the break point type, such as, SOURCE_BREAKPOINT_SUPPORT, METHOD_BREAKPOINT_SUPPORT, or WATCH_POINT_SUPPORT
The following examples show sets of interface definitions for two embodiments, developed using the Java language. It will be understood that the invention is equally applicable to any programming language. This example is presented for illustrative purposes only and is not meant to limit the scope, functionality or spirit of any particular embodiment of the invention.
Network Messages
As has already been discussed, some embodiments use facilities in the runtime-messaging environment to perform debugging operations on network messages. This capability is demonstrated here by example shown in the table below developed using the Java language. In another embodiment, method calls may be made via the native debugging infrastructure JDl. Methods are called on the ScriptController via JDl to do continues and other such tasks. Breakpoints are executed by hitting actual Java breakpoint and are then translated in the proxy to script breakpoint. Thus, breakpoints reduce to java breakpoints. JDl sends a message to the proxy in the underlying JDl protocol. For example, a packet may be sent from the server to the proxy that includes meta-data for a scripting language. The meta-data is used to determine whether to treat the language as a scripting language or to treat the language as a native language. It will be understood that the invention is equally applicable to any programming language. This example is presented for illustrative purposes only and is not meant to limit the scope, functionality or spirit of any particular embodiment of the invention.
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.
The present application claims the benefit of priority under 35 U.S.C. §119(3) to: U.S. Provisional Application entitled “Systems and Methods for Multi-Language Debugging,” patent application No. 60/450,014, filed on Feb. 26, 2003, which application is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
60450014 | Feb 2003 | US |