Using the Integrated Debugger

Full-function integrated Java debugger allows you to debug your projects right inside Together.

Debugger features


Accessing debugger commands

There are several ways to access the debugger commands:

Starting a Debugger session

Tip: Before starting a debugging session be sure you've set up all the needed breakpoints. For more information see Working with breakpoints.

To start a debugging session choose Tools | Run/Debug | Run in debugger menu command (hot key is Shift-F9). This starts your projects in debug mode and automatically shows Debugger Tab. Debugger Tab significantly speeds up access to the information you could need during the debugging process.

Debugger Tab

Debugger tab has its own elements:

Controlling program execution

When a debug session starts, you have to control the program execution, using the following set of control commands:

Command

Icon

Description

Hot
Key

Pause

 

Pauses program and passes control to the debugger.

 

Continue

 

Resumes program execution.

 

Stop program

 

Terminates the program and debugging session.

Shift-F2

Run to cursor

 

Resumes program and breaks before cursor.

F4

Step over

 

Skips debugging of a method that is currently under cursor. The method executes and returns result.

Shift-F8

Step into

 

Forces debugging of a method that is currently under cursor. Debugger stops at the first line of this method.

Shift-F7

Step out

 

Forces current method execution and stops in the current method's caller at the next line after call.

 

Run to end of method

 

Forces current method execution and stops before return.

 

Toggle smart step

 

Debugger performs a "smart step". You can set up smart step abilities using "Debugger" tab of the Options Dialog.

 

Tip: For fast access to these commands use hot keys or the Debugger Tab toolbar.

Working with breakpoints

Breakpoints provide the most powerful debugging facility, which makes it possible to break program execution at the specified place, in order to inspect variables, class members, etc.

Setting breakpoints

There are several methods of setting up breakpoints within the Editor:

Select the line of code you want set up breakpoint at, and...

  1. Press F5 key.

  2. Right click on the line and select "Toggle breakpoint" on the speedmenu.

  3. Click one of the breakpoint buttons of the Debugger Tab toolbar.

Or just click on left margin next to the this line. (See also: User's Guide: Using the Editor: Setting breakpoints)

Controlling breakpoints

"Breakpoints" tab of the Debugger Tab provides a toolbar enabing full control of breakpoints. You can:

  1. Disable all breakpoints

  2. Enable all breakpoints

  3. Remove all breakpoints

  4. Edit breakpoint properties

  5. Go to breakpoint

  6. Disable/Enable breakpoint

  7. Remove breakpoint

  8. Add line breakpoint

  9. Add exception breakpoint

  10. Add class breakpoint

  11. Add method breakpoint

Modifying breakpoint properties

When you choose "Breakpoint properties" command, the following dialog is displayed.

Using this dialog you can specify if there should be a stop execution at this point, specify number of passes through this breakpoint before stop, and also whether this stop should be logged or not.

Examining data values at breakpoint

When staying at the breakpoint you can examine data using "Add watch" command, available from "Tools | Run/Debug" menu and from the Debugger Tab toolbar.

Watching variables and attributes

Watching class members, inspecting objects etc. is an important side of the debugging process. Select Tools | Run in Debugger on the Editor speedmenu or on the main menu.

 This will open Debugger tab with the full set of elements, and show "Add Watch" command on the Editor speedmenu. Now you can add watch on the Watches tab of the Debugger, or from the Editor speedmenu.

Specify the expression you would like to watch and its description (optionally). This expression displays on the "Watches" tab of the Debugger Tab.

Modifying watches

From the context menu of "Watches" tab you can:

Evaluating and modifying variables

Together allows access the variables in course of program execution. Set breakpoint in the desired location of your code and select Tools | Run in Debugger on the Editor speedmenu or on the main menu. This adds Evaluate tab to the Debugger pane and Evaluate/Modify command to the Editor speedmenu.

While your program runs in the Debugger, you can check the value of each object. To do this, you need only navigate the cursor to the desired object, and after a small delay the description of this object will show up. The form of presentation is defined by the Use structured context evaluation flag in the Options | Debugger. If the flag is set (by default), evaluation window shows the entire structure and value of an object.

If this flag is cleared, evaluation window shows object's address or value only:

It is also possible to evaluate and modify objects in the Evaluate tab of the Debugger pane. To do this, select Evaluate command on the Editor's speedmenu and specify variable or expression to be evaluated/modified.

Appropriate entry adds to the Evaluate tab, showing location, type and value of the object in question.

You can change the value of variables, typing directly in the Expression field of the tab. Click arrow icon for the changes to take effect.

Note: you can only evaluate and modify objects within the current debugging context. If you try to check an object past the breakpoint, the Result field will report that the variable is out of range.

Attaching to a remote process

You can remotely debug Java programs with the integrated debugger. Start the external Java program to be remotely debugged (debugged per attach) in the following way:

java ... -Xdebug -Xnoagent -Djava.compiler=NONE --> -Xrunjdwp:transport=dt_socket,address=8787,server=y,launch="%1\bin\win32\display.bat %1"

If port 8787 is not convinient for you, you could allow the JVM to define the port:

-Xdebug -Xnoagent -Djava.compiler=NONE --> -Xrunjdwp:transport=dt_socket,server=y,launch="%1\bin\win32\display.bat%1"

In the latter case, the JVM prints the address. Note the address and enter value in the debugger attach dialog.

See also:

Using the editor
Debugging an Applet
Debugging a Servlet
Debugging a JSP