Line Numbers

Line numbers are useful for source-level debugging. In Source mode, you see a program displayed with each line numbered consecutively. CodeView allows you to use line numbers to specify the address of code generated for a line or to specify a certain line in a text file.

Syntax

[[context]].linenumber
[[context]]@linenumber

The optional context is the context operator used to specify a certain file. When it is omitted, CodeView assumes that the line is in the current source file. The linenumber specifies the line in the file (numbered starting at 1). Some commands, such as the Breakpoint Set (BP) command, display an error message if the compiler does not generate code for the specified line. For more information on the context operator, see “The Context Operator”.

With most CodeView commands, the two forms are interchangeable because CodeView automatically maps between source lines and code addresses. The .linenumber form specifies a line offset from the beginning of a file. Use this form with the View Source (VS) command to display any text file, including files that are not source files for the program you are debugging. The @linenumber form specifies the address of the beginning of the code generated by the compiler for the specified line. Use this form with the Breakpoint Set (BP) command.

Examples

The following example uses the Go (G) command to execute the program from the current location up to line 100. Since no file is indicated, CodeView assumes the current source file.

>G @100

The following commands use the View Source (VS) command to display text files at specific lines as follows: line 10 of the current file, line 301 of EXAMPLE.CPP, and line 22 of TESTFILE.TXT.

>VS .10

>VS {,EXAMPLE.CPP}.301

>VS {,TESTFILE.TXT}.22