DVT Debugger Integration - Part II - Debugging Your Code from within the DVT IDE
Overview
The DVT Debugger Add-On Module, an extension of the DVT Eclipse IDE, allows you to debug your code from within the DVT IDE: add breakpoints, control the simulation (stop, resume, step), inspect variables, and so on.
To control the simulation from within DVT, a communication channel must be established with the simulator. The first part of this demo movie series shows how to connect DVT to a simulation launched either from DVT (using a DVT Generic Run Configuration) or from outside DVT (from example in a terminal). In both situations, one has to pass the simulator a set of specific command line switches, documented in the DVT Debugger Integration Simulation Prerequisites documentation page: https://eda.amiq.com/documentation/eclipse/sv/toc/debugger-integration/simulation-prerequisites.html.
The second part of this demo movie series illustrates the flow of a typical debug session: first add some breakpoints and resume the simulation until it hits the first breakpoint. Then step through some code, navigate the call stack, inspect and watch variables. It's even possible to change a variable value: it's just a click away!
For further information about the DVT Debugger, please visit: https://eda.amiq.com/products/dvt-debugger
Details
Debug Perspective
When you connect to a simulation, DVT recommends switching to the Debug Perspective, which is a convenient arrangement of debug-related views. All of DVT's capabilities are also available.
Let's use CTRL+I to bring up the Quick Compile Order view and locate the master_driver source file. CTRL+O pops up the Quick Outline view and allows us to locate the drive_transfer
task.
Breakpoints
Now let's add some breakpoints. Double-click next to the desired line on the editor's vertical left bar. Let's do the same for the slave_monitor's collect_transactions
, and for the scoreboard's memory_verify
.
The Breakpoints View shows a summary of all the breakpoints.
Controlling the Simulation
The Debug Toolbar buttons control the simulation. Let's click on Resume to run the simulation until the scoreboard breakpoint is hit. Note that the currently executed line is automatically revealed and highlighted, and likewise when going up and down the call stack.
Now let's step over a few lines, then out of the memory_verify
function and other caller functions until we get inside the monitor scope. Then let's step into
Browsing and Watching Variables
In the Variables View, we can browse the current scope variables. Suppose we are interested in some specific transaction data, like address
and direction
, so let's watch these in the Expressions View.
Simply hovering over a variable in the editor will pop up a tooltip, which presents the usual information enriched with the current variable value.
Conditional Breakpoints
Now let's break inside the driver only when the transaction address
is an even number. To do this, we right-click on the breakpoint, go to Properties, and fill in the condition. We can also disable the other breakpoints for now to hit directly the driver one.
Modifying Variable Values
If we are interested in what happens when the transaction has a different direction
, we can simply change the direction
from the Variables View.