Anchor | ||||
---|---|---|---|---|
|
An example of a generic scenario with a breakpoint in GenericVictimSimulation.simulate is shown in Figure 309. In Intellij you set breakpoints by clicking in the margin of the file. This will cause a red dot to appear and when running in debug mode the code will freeze when that point is reached.
Tip: to find classes (i.e. to get the GenericVictimSystemSimulation.java) do Ctrl+N.
Figure 309: Code inspection - Setting breakpoints Anchor F309 F309
SEAMCAT is launched in debug mode from Intellij. This is done by opening Seamcat.java and right-clicking on the class name. In the menu that appears choose ‘Debug ‘Seamcat.main()’.
Figure 310: Launch SEAMCAT in debug mode Anchor F310 F310
SEAMCAT will now open and a scenario can be setup. When a scenario has been set up as wanted, the simulation is run by pressing the simulation start button.
Once the execution of the code reaches the point in the code where the breakpoint is set the execution will pause and the breakpoint will light up in Intellij (see Figure 311). Now the developer controls the execution flow.
The button panel below has different control buttons to handle the code flow: step over will go to the next line of code. Step into will go into the method on the line. This has to be tried a number of times before one masters this!
Figure 311: Catching breakpoint Anchor F311 F311
The callstack shows how we got here in the code (Figure 312). This is extremely valuable for inspecting who calls who during the simulation. Here we see that we are coming from line 114 in GenericVictimSystemSimulation.java. This only apply during an active breakpoint i.e. When the code it temporary suspended.
Figure 312: Callstack Anchor F312 F312
The evaluate can be used to evaluate expression in the current code state. Here we take one of the variables eventResult and evaluates the expression eventResult.getDRSSResult(). This evaluates to the double value 0.0. This only applies when you have an active breakpoint.
Figure 313: Expression evaluation Anchor F313 F313