The Source view contains two columns with a gray background on the left that contain the line number and bullets that represent executable code locations. The right side of the view contains your source code. See Figure 3.18 for an example.
The button with the green arrow shown in Figure 3.17 scrolls the code browser to the location of the statement or instruction that is to be executed next. You can find this button at the top left of the Source view window.
Click on the left-most column in the Source code view to highlight the corresponding addresses in the disassembly view. The highlighting reveals the instructions the source statement maps to.
Highlighting is only available for source lines with a bullet. The bullet indicates that the line is executable.
Double-click on a bullet to set a breakpoint on the source line. A red disk is displayed next to the line to indicate that a breakpoint has been set, as shown in Figure 3.18.
The Source code view title bar has additional controls for:
selecting a target line in the source using the Line: entry box
selecting a source file that has already been loaded using the File: drop down list
opening the Debug Source Files dialog.
Right-click in the Source view to display the context menu. The menu has the following options:
- Insert Breakpoint
Insert a breakpoint at the selected location.
- Enable Breakpoint
Enable the breakpoint at the selected location.
- Breakpoint Properties
If a breakpoint is present on the selected instruction, selecting this option displays the Breakpoint properties dialog.
- Run to here
Run to the selected instruction
- Word wrap
Wrap text to fit inside window
- File properties
Display the filename and path for the currently displayed file.
The Debug Source Files dialog, shown in Figure 3.19, lets you locate source files required for debugging an application. To open the dialog, click on the icon in the upper right corner of the Source view.
Pathnames are displayed with slash (/) characters, even on Windows. This does not affect operation.
The tabs switch between two different views that list the properties for the source file:
This column contains a list of files referred to by the debugged application. This column is not shown in Hierarchy view.
- Debug pathname
This column shows the path for the respective file taken from the debug information of the application. This path might be invalid as it refers to the original source file at compilation time. The debug pathname can be absolute or relative to the executable.
- Actual pathname
This column contains the path Model Debugger actually uses to locate the file. If the last column is empty or contains an invalid path, the path can be set by double-clicking a row or selecting a row and clicking Open File. The File Open dialog displays to enable selecting the source file. After selecting the file, the file is opened in the debugger.
Click on Find File to display the Find source file dialog shown in Figure 3.20 and navigate to the directory containing the source.
Click on Properties to display the File Properties dialog for the selected file as shown in Figure 3.21. You can also use the Find File button on the File Properties dialog to locate the file.
Model Debugger has an automatic mechanism to add replacement paths that are invoked every time you are prompted to find a source file. If the source file is found, an automatic source path replacement is calculated.
This path might not always be correct, and there are situations where you must manually edit source path replacements because the automatic path is wrong for the specific context. You might, for example, have a header file whose name is common between two different compilers, and Model Debugger chooses the wrong one.
Click on Source Paths... to open the Source Path Replacements dialog as shown in Figure 3.22. Use this dialog to change the path, or priority of the paths, to the source files for the application.
The source path replacements are stored in the Model Debugger session file and not with user preferences.
Existing source file replacements are displayed in the top part of the Source Path Replacement dialog. You can remove or reorder paths by highlighting an entry and clicking one of the following buttons:
- Move Up
Move the selected path up one position in the list.
- Move Down
Move the selected path down one position in the list.
- Remove Entry
Delete the selected path from the list.
Debug Path and Actual Path have the same meaning as in the Debug Source Files dialog shown in Figure 3.19.
In the lower part of the Source Path Replacement dialog, you can add new source paths or modify existing ones. The additional features are:
- Debug info paths
Provides a tree view that simplifies navigation through the debug paths found in the debug information of the source file.
Click this button to select an path with a browser rather than typing in the actual path directly.
- Apply Changes
Modify the selected entry using the changes entered.
- Insert as New Entry
Adds the new path to the source path replacement list.
You can search for text in the active window by using the Find dialog. The active window is surrounded by a thin black frame. Click Find on the Search menu to open the Find dialog shown in Figure 3.23:
Type the text to find in the box and click the Find Next or Find Previous buttons to search upwards or downwards from the current cursor position. You can re-use previous search terms by clicking on the drop-down arrow on the right of the text entry box.
The dialog is modeless, so you can change views without closing the dialog. The mode is updated automatically.