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.
The button with the green arrow 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.
Arrow button for scrolling code
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 filled red circle is displayed next to the line to indicate that a breakpoint has been set.
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 box.
Context menu for Source view
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 box.
- 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.
Debug Source Files dialog box
The Debug Source Files dialog box lets you locate source files required for debugging an application. To open the dialog box, 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.
Debug Source Files dialog box
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 box 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 box and navigate to the directory containing the source.
Find Source File dialog box
Click on Properties to display the File Properties dialog box for the selected file. You can also use the Find File button on the File Properties dialog box to locate the file.
Source File Properties dialog box
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 box. Use this dialog box 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.
Source Path Replacement dialog box
Existing source file replacements are displayed in the top part of the Source Path Replacement dialog box. 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 box.
In the lower part of the Source Path Replacement dialog box, 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.
Searching in source files
You can search for text in the active window by using the Find dialog box. The active window is surrounded by a thin black frame. Click Find on the Search menu to open the Find dialog box.
Find dialog box
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. Re-use previous search terms by clicking on the drop-down arrow on the right of the text entry box.
The dialog box is modeless, so you can change views without closing it. The mode is updated automatically.