Arm DDT uses a tabbed-document interface as a method of presenting multiple documents. This allows you to have many source files open. You can view one file in the full workspace area, or two if the Source Code Viewer is 'split'.
Each component of Arm DDT is a dockable window, which may be dragged around by a handle, usually on the top or left-hand edge. Components can also be double-clicked, or dragged outside of Arm DDT, to form a new window. You can hide or show most of the components using the View menu. The screenshot shows the default Arm DDT layout.
The following table shows the key components:
|(1) Menu Bar|
|(2) Process Controls|
|(3) Process Groups|
|(4) Find File or Function|
|(5) Project Files|
|(6) Source Code|
|(7) Variables and Stack of Current Process/Thread|
|(8) Parallel Stack, IO and Breakpoints|
|(9) Evaluate Window|
|(10) Status Bar|
Most of the user-modified parameters and windows are saved by right-clicking and selecting a save option in the corresponding window.
However, Arm DDT also has the ability to load and save all these options concurrently to minimize the inconvenience in restarting sessions. Saving the session stores such things as Process Groups, the contents of the Evaluate window and more. This ability makes it easy to debug code with the same parameters set time and time again.
To save a session simply use the Save Session option from the File menu. Enter a file name (or select an existing file) for the save file and click OK. To load a session again simply choose the Load Session option from the File menu, choose the correct file and click OK.
Arm Forge provides code viewing, editing and rebuilding features. It also integrates with the Git, Subversion and Mercurial version control systems and provides static analysis to automatically detect many classes of common errors.
The code editing and rebuilding capabilities are not designed for developing applications from scratch, but they are designed to fit into existing debugging or profiling sessions that are running on a current executable.
When Arm DDT begins a session, source code is automatically found from the information compiled in the executable.
Source and header files found in the executable are reconciled with the files present on the front-end server, and displayed in a simple tree view within the Project Files tab of the Project Navigator window. Source files can be loaded for viewing by clicking on the file name.
Whenever a selected process is stopped, the Source Code Viewer will automatically leap to the correct file and line, if the source is available.
The source code viewer supports automatic color syntax highlighting for C and Fortran.
You can hide functions or subroutines you are not interested in by clicking the '-' glyph next to the first line of the function. This will collapse the function. Simply click the '+' glyph to expand the function again.
Source code may be edited in the code viewer windows of DDT. The actions Undo, Redo, Cut, Copy, Paste, Select all, Go to line, Find, Find next, Find previous, and Find in files are available from the Edit menu. Files may be opened, saved, reverted and closed from the File menu.
Information from Arm DDT will not match edited source files until the changes are saved, the binary is rebuilt, and the session restarted.
If the currently selected file has an associated header or source code file, it can be opened by right-clicking in the editor and choosing Open <filename>.<extension>. There is a global shortcut on function key F4, available in the Edit menu as Switch Header/Source option.
To edit a source file in an external editor, right-click the editor for the file and choose Open in external editor. To change the editor used, or if the file does not open with the default settings, open the Options window by selecting File → Options (Arm Forge → Preferences on Mac OS X) and enter the path to the preferred editor in the Editor box, for example /usr/bin/gedit.
If a file is edited the following warning will be displayed at the top of the editor:
If source files are edited, the changes will not take effect until the binary is rebuilt and the session restarted. To configure the build command choose File → Configure Build…, enter a build command and a directory in which to run the command, and click Apply.
To issue the build command choose File → Build, or press Ctrl+B (Cmd+B on Mac OS X ). When a build is issued the Build Output view is shown. Once a rebuild succeeds it is recommended to restart the session with the new build by choosing File → Restart Session.
Changes to source files may be committed using one of Git, Mercurial, and Subversion. To commit changes choose File → Commit…, enter a commit message to the resulting dialog and click the commit button.
The Project Files tree shows a list of source files for your program. Click on a file in the tree to open it in the Code Viewer. You may also expand a source file to see a list of classes, functions, defined in that source file (C / C++ / Fortran only).
Clicking on any source code element (class, function, and so on) will display it in the Source Code viewer.
Arm DDT automatically splits your source code into Application Code, which is source code from your application and External Code, which is code from third party libraries. This allows you to quickly distinguish between your own code and third party libraries.
You can control exactly which directories are considered to contain Application Code using the Application / External Directories window. Right-click on the Project Files tree to open the window.
The checked directories are the directories containing Application Code. Once you have configured them to your satisfaction click Ok to update the Project Files tree.
In some situations, not all source files are found automatically. This can also occur, for example, if the executable or source files have been moved since compilation. Extra directories to search for source files can be added by right-clicking while in the Project Files tab, and selecting Add/view Source Directory(s). You can also specify extra source directories on the command line using the --source-dirs command line argument (separate each directory with a colon).
It is also possible to add an individual file, if this file has moved since compilation, or is on a different (but visible) file system. To do this right-click in the Project Files tab and select the Add File option.
Any directories or files you have added are saved and restored when you use the Save Session and Load Session commands inside the File menu. If DDT does not find the sources for your project, you might find these commands save you a lot of unnecessary clicking.
The Find Files Or Functions box appears above the source file tree in the Project Files view.
You can type the name of a file, function, or other source code element (such as classes, Fortran modules, and so on) in this box to search for that item in the source tree. You can also type just part of a name to see all the items whose name contains the text you typed.
Double-click on a result to jump to the corresponding source code location for that item.
The Find menu item can be found in the Edit menu, and can be used to find occurrences of an expression in the currently visible source file.
DDT will search from the current cursor position for the next or previous occurrence of the search term. Click on the magnifying glass icon for more search options.
Case Sensitive: When checked, DDT will perform a case sensitive search. For example, Hello will not match hello.
Whole Words Only: When checked, DDT will only match your search term against whole 'words' in the source file. For example Hello would not match HelloWorld while searching for whole words only.
Use Regular Expressions: When this is checked, your search may use Perl-style regular expressions.
The Find In Files window can be found in the Edit menu, and can be used to search all source and header files associated with your program. The search results are listed and can be clicked to display the file and line number in the main Source Code Viewer; this can be of particular use for setting a breakpoint at a function.
Case sensitive: When checked, DDT will perform a case sensitive search. For example, Hello will not match hello.
Whole words only: When checked, DDT will only match your search term against whole 'words' in the source file. For example Hello would not match HelloWorld while searching for whole words only.
Regular Expression: When checked, DDT will interpret the search term as a regular expression rather than a fixed string. The syntax of the regular expression is identical to that described in the appendix I.6 Job ID regular expression.
DDT has a go to line function which enables the user to go directly to a line of code. This is found in the Edit menu. A window will be displayed in the centre of your screen. Enter the line number you wish to see and click OK. This will take you to the correct line providing that you entered a line that exists. You can use the hotkey CTRL+L to access this function quickly.
After jumping to a source code location or opening a new file, it is possible to return to the previous location using the "Navigate backwards in source code history" button on the toolbar or item in the "Edit" menu. This can be done several times to revisit previous locations in the source code.
Static analysis is a powerful companion to debugging. Arm DDT enables the user to discover errors by code and state inspection along with automatic error detection components such as memory debugging. Static analysis inspects the source code and attempts to identify errors that can be detected from the source alone, independently of the compiler and actual process state.
Arm DDT includes the static analysis tools cppcheck and ftnchek. These will by default automatically examine source files as they are loaded and display a warning symbol if errors are detected. Typical errors include:
- Buffer overflows. Accessing beyond the bounds of heap or stack arrays.
- Memory leaks. Allocating memory within a function and there being a path through the function which does not deallocate the memory and the pointer is not assigned to any externally visible variable, nor returned.
- Unused variables, and also use of variables without initialization in some cases.
The version control integration in DDT and MAP allows users to see line-by-line information from Git, Mercurial or Subversion next to source files. Information is color-coded to indicate the age of the source line.
To enable select the Version Control Information option from the View menu. When enabled columns to left of source code viewers are shown. In these columns are displayed how long ago the line was added/modified. Each line in the information column is highlighted in a color to indicate its age. The lines changed in the current revision are highlighted in red.
Where available lines with changes not committed are highlighted in purple. All other lines are highlighted with a blend of transparent blue and opaque green where blue indicates old and green young.
Currently uncommitted changes are only supported for Git. Arm Forge will not show any version control information for files with uncommitted changes when using Mercurial or Subversion.
A folded block of code displays the annotation for the most recently modified line in the block.
Hovering the cursor over the information column reveals a tool-tip containing a preview of the commit message for the commit that last changed the line.
To copy the commit message right-click the column on the desired row and from the menu select Copy Commit Message.
See also Version control breakpoints and tracepoints .