This section describes the Source view.
The Source view on the left contains two columns with a gray background 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.
Figure 2-19 Arrow button for scrolling code
To highlight the corresponding addresses in the disassembly view, click the left-most column in the Source view. The highlighting reveals the instructions the source statement maps to.
NoteHighlighting is only available for source lines with a bullet. The bullet indicates that the line is executable.
To set a breakpoint on the source line, double click a bullet. A filled red circle is displayed next to the line to indicate that a breakpoint has been set.
Figure 2-20 Source view
The Source view title bar has 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 the text to fit inside the window.
- File properties
Display the filename and path for the file.
Debug Source Files dialog box
The Debug Source Files dialog box lets you locate source files that are required for debugging an application. To open the dialog box, click the icon in the upper right corner of the Source view.
NotePathnames appear with slash (/) characters, even on MS Windows. This fact does not affect operation.
Figure 2-21 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 that the debugged application refers to. This column is not shown in Hierarchy view.
- Debug pathname
This column shows the path for the file. The pathname comes from the debug information of the application. This path might be invalid because 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. You can set the path by double clicking a row or selecting a row and clicking Open File. The File Open dialog box enables selecting the source file. After selecting the file, the file is opened in the debugger.
Click Find File to display the Find source file dialog box and navigate to the directory containing the source.
Figure 2-22 Find Source File dialog box
Click Properties to display the File Properties dialog box for the selected file. You can also use the Find File button in the File Properties dialog box to locate the file.
Figure 2-23 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. There are situations where you must manually edit source path replacements because the automatic path is wrong for that 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 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.
NoteThe source path replacements are stored in the Model Debugger session file and not with user preferences.
Figure 2-24 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 path up one position in the list.
- Move Down
Move the path down one position in the list.
- Remove Entry
Delete the 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 in the debug information of the source file.
Click this button to select a path with a browser rather than typing in the actual path directly.
- Apply Changes
Modify the selected entry using the entered changes.
- 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. Click Find on the Search menu to open the Find dialog box.
Figure 2-25 Find dialog box
Type the text in the box and click the Find Next or Find Previous buttons to search upwards or downwards. Re-use previous search terms by clicking 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.