Table of Contents
Ant or Maven project is opened in Visual Studio. You can find instructions how to create an Ant project in this section. A debug session is started. You can find instructions how to start a debug session in preceding chapters (there are many ways).
IntegraStudio provides fully functional Java debugger. This section sumarizes features that you can use during debugging of Java programs. Described options correspond to Visual Studio 2013 Ultimate release. Older or lesser editions of Visual Studio may lack some of these options.
Standard Locals window is supported. IntegraStudio can display values of a variety of Java types: scalar types (boxed and unboxed), arrays, strings, classes, as well as many of standard library containers. The container display engine is extensible and uses Python scripts to extract information from Java classes.
You can set breakpoints in Java code. Additional options, like conditions, hit counters, temporary disabling, filters, hit actions are also supported.
You can debug multithreaded programs. Visual Studio displays Java threads as usual, in the Threads window.
IntegraStudio supports also the Freeze / Thaw feature. You can freeze a thread, so that it will remain in stopped state after resuming execution. The Thaw option unfreezes a thread, so that it will be run again.
IntegraStudio also supports the Watch window. Here you can type variable names or simple expressions and view their values.
Parallel stacks window is a feature of recent Visual Studio versions allowing to view stacks of multiple threads simultaneously on a diagram. IntegraStudio supports parallel stacks.
Immediate window is an alternative to Watch window. You can type expressions into the window, and the debugger will evaluate them immediately, displaying values in a text form.
IntegraStudio debugger can also debug exceptions. There is an option to stop the execution of the program when an exception is thrown, caught or uncaught. You can also specify exception classes to be taken into account (with the rest being ignored). In order to configure exception handling, choose the Exceptions... option from Debug menu. The following dialog will appear:
In the dialog, exceptions are divided into several categories. IntegraStudio adds its own categories (marked by a red rectangle above). Those categories are:
In order to add a class name to one of the categories, click the Add button. Now you have to select desired category:
Click OK when finished. You can also delete any exception class, by selecting it and clicking Delete.
After you add a class name, do not forget to enable it by clicking on the check box next to the name, in the Thrown column. Note that the Thrown column means just that reporting is enabled, and the actual moment (thrown or caught) is dependent on the category. This is because Visual Studio supports only Thrown column, there is no way to add additional columns. Under some Visual Studio versions you might also see additional User unhandled column, which is not used by IntegraStudio.
A data breakpoint is triggered when particular field changes its value, is being read or both. They can be set on any field of an object, a static field of a class, or a non-static field of a class (those will work for for any object of that class). Data breakpoints on local variables are not supported, because the Java Platform Debugger Architecture does not provide them.
In order to create a data breakpoint, open the Breakpoints window (from Debug/Windows menu), click on the New option and choose New data breakpoint.... The following window will appear, allowing you to specify the field on which the breakpoint has to be put.
This is a standard window provided by Visual Studio. Although it looks somewhat C/C++ centric, IntegraStudio extends it to accept Java field specifications. First of all, you need to prefix the expression with ampersand (&) operator. It is not used in Java language (only in C/C++), but in this context it indicates a field specification expression. After the (&) operator type the proper expression. Ignore all remaining settings (they are irrelevant for Java). The expression can have one of these forms:
Besides data breakpoints activated on a field change, IntegraStudio can detect also a read access to a field. There is also an option to detect both type of accesses (read and write) simultaneously. In order to specify such kind of data breakpoint, use double (&&) or triple (&&&) ampersand operator instead of single one, according to the following scheme:
All types of data breakpoints are presented by Visual Studio with their numerical identifiers. Those identifiers are hexadecimal numbers, and Visual Studio prints something like when 0x8000000000000001 changes as a description of the breakpoint. This is normal and is a consequence of the fact, that data breakpoints were designed as a C/C++ debugger feature. Visual Studio user interface shows them using pseudo-addresses, hence hexadecimal numbers and byte sizes. Of course the mechanism can be extended to other languages like Java (it is what IntegraStudio does), but the presentation format remains and is not alterable.
Using ampersand operators is valid only in the context of data breakpoints. They are not Java language operators. Entering them in other debugger windows (like Watch or Immediate) will yield a numerical identifier, but will not create actual data breakpoint. The hexadecimal number is also not a memory address of the field in JVM heap. It is just an opaque identifier of a field.
You can also order the debugger to stop the program when specific function is called. Open the Breakpoints window (from Debug/Windows menu), click on the New option and choose Break at function.... The following window will appear, allowing you to specify the function on which the breakpoint has to be put.
Enter fully qualified function name (with packages and class). Ignore rest of the fields. This window is a standard Visual Studio window and is being used for all languages. Only the Function field is relevant for Java.
The breakpoint will be hit when specified function is called.
For Java programs which are started by IntegraStudio, the process input and output is intercepted and redirected to the Process Console. Here you can view the standard output (stdout and stderr) of the process, as well as type characters to be sent to the stdin.
To open the console, choose Show process console from IntegraStudio menu. The console window will be shown:
You can clear the contents by clicking Clear. The console displays all output sent to standard streams, so there can be additional messages from Java Virtual Machine (not originating in your program), like the Listening ... message shown above.
The console works only for processes launched by IntegraStudio (not attached).
Table of Contents