A Short Tour to JDB

From OO Lab
Revision as of 11:42, 22 November 2011 by RyanYang (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A Short Tour to JDB on xDIVA

Once you complete the installation of the necessary components of xDIVA. You are good to go.

  1. find the directory xDIVA/Minerva in your installation or you can find the shortcut in Start->All programs->xDIVA
  2. Double click on Minerva7.3.jar or click the shortcut Run Minerva7.3

If your jdk is installed properly, a Minerva UI will pop up.

Minerva UI.jpeg

Before you start debugging programs , make sure you have run the DIVA visualize window. You can find the shortcut named Run DIVA in Start->All programs->xDIVA.

If your OgreSDK is installed properly , a DIVA visualization window will pop up.

DIVA UI.jpg

This debugger front-end is pretty easy to learn. Let's open a Java file to debug.

  1. Click "File" on the menu bar
  2. Choose "Open file"
  3. Change your directory to Examples/Java in your installation directory
  4. Choose ubvm.java 

Now, ubvm.java is loaded and displayed in the main window as in the figure above.

  1. Set break point on line 15.
  2. Click "run" button

A menu will be pop up

The run menu

When you press Easy Run button , Minerva will automaticlly set the project path and main file path. If you don't want Minerva to help you set path , you can press the button which next the project path's and main file's text area. In Example directory , the programs have been compiled so the default compile select option is Run without Compile. You also can modify the program then select Run with Compile when you press theRUN button on Minerva UI. After setting the project path and main file , you can press the RUN button on the RUN menu. And you can see there is a little yellow arrow on the breakpoint at line 15.

Hit Breakpoint 15.jpg

It means your program is stopping at line 15 , then you can press the VISUALIZE button on the menu bar to choose the value you want to visualize.

Visualize button.jpg

Minerva will pop up a input dialog like this.

Visualize Dialog.jpg

You can type the variable name by yourself or let Minerva to capture the variable name only if you use the cursor to click mouse left on the value name before you press the VISUALIZE button. Let's visualize the integer variable ivar. After typing variable name ivar, now press the OK button. There is a dialog will pop up, it's called Mapping Dialog, in which you can configure the way how you want to visualize the variable.

Mapping Dialog.jpg

The structure of the visualized object is shown in the middle sub-window. The left sub-window contains a set of basic building blocks called to construct visualizations for the variable. These basic building blocks are called mapping nodes, which are categorized by their functionality. If a mapping node carries avisualization metaphor(VM), it is capable of transforming variable values into a 3D shape. These mapping nodes are categorized and the category can be changed by clicking the tabs.

The right sub-window is an editing area in which to place mapping nodes. By dragging and dropping the links between mapping nodes to form a mapping tree, a visualization can be constructed.

Let's click on CUBE_UBVM to make an example. After double click CUBE_UBVM , there is a green mapping node show on the mapping editing area in right subwindow.

After click cube ubvm.jpg

The green node you see is a mapping node. A mapping node has IN ports and OUT ports. An IN port can accept a single link from another source which can be a variable in the middle sub-window or a mapping node. An OUT port, on the other hand, can be linked to many other destinations. A mapping tree is evaluated to create its visualization from the bottom (i.e. the variables in the middle sub-window) of the tree to the root, where the links are used to pass objects between mapping nodes.

Suppose we want to make the size of CUBE at x-axis to be changed with the variable ivar. Right clicking on the mapping node, a menu will pop up. You canSet Node Attributes 、 Remove Mapping Node 、

Remove OutLinks and Copy. In this example , please select Set Node Attributes option.

Press Mouse Right button on VM.jpg

After click the Set Node Attributes option , you will see a dialog like this.

Attribute Dialog.jpg

In this dialog , you can decide what attibute you want VM to show. For example , the _vm_rx is related to the VM's X-axis position and_vm_sizex is related to the VM's length in X-axis....etc. These are called default 3D properties of a 3D Shapes. All the properties of a 3D shape is listed below. Default properties are hidden by default.

   x-axis size, y-axis size, z axis,
   x-axis scale, y-axis scale, z-axis scale,
   x-axis position, y-axis position, z-axis position,
   red in RGB, green in RGB, blue in RGB,
   x-axis rotation, y-axis rotation, z-axis rotation,
   quaternion, transparency


Let's double click on one of attriutes , the Visible field will switch between true and false. In this example , please make attribute _vm_sizex visiable.

Set sizeX as true.jpg After press OK button , the mapping node display a port named _vm_sizexAfter Setting.jpgNow, please use mouse to drag and drop the line between variable and mapping nodes. We first connect the _vm_name to ivar, because we want the shape display its variable name. Next, we connect _vm_sizeX to ivar because we want the cube to change size at X-axis by the variable. Finally, we link_vm_clickmsg with the variable. _vm_clickmsg has a type name called "tostring*". The link will translate the value of the source into a string. We want xDIVA to display ivar value when this cube is clicked.

Connect the relation between variable & vm.jpg

After links are done, press OK button on mapping dialog. In DIVA visualize window , you will see a cube. Because we had open the _vm_name port , there will be a tag shows variable name on the VM top. The CUBE has default size of (100,100,100).

However, the connection of _vm_sizex port makes cube length to be 50, which is the value of ivar. If user cursor clicks on the VM , it will show the value in front of VM

Visualize result.jpg

In DIVA visualize window , there are several buttons at lower right corner of window. They are STEPNEXTCONT . You can continue the debuggee in xDIVA or in Minerva. When new break point is hit, the update of the visualized variable will make VM to change. Here we show the function of the STEP button. When you click the STEP button , the program will step to next line. Now , we set another breakpoint in line 16 then press STEP button on DIVA window

STEP NEXT CONT button.jpg

or Minerva toolbar.

STEP button on Minerva.jpg

And you can see the yellow arrow move to line 16.

Set breakpoint 16 then press STEP.jpg

The VM will be changed like this.

After STEP.jpg

You can use the following keys to browse the visualization

  • W - move forward
  • S - move backward
  • A - move left
  • D - move right
  • R - move up
  • F - move down
  • O - reset the camera to its position
  • Z - roll left
  • X - roll right

You can also move camera by

  • click on the space (no VM is clicked) and dragged the mouse.

In DIVA UI Commentary? , we will explain the function of UI.

Personal tools