These records say which source lines the code came from. Debug information proper goes in Borland or CodeView data elsewhere; OMF itself has only these two records.
LINNUM (0x94, 0x95)
| Field | Size | Meaning |
|---|---|---|
| Base group | index | An index into the GRPDEFs, usually 0 |
| Base segment | index | An index into the SEGDEFs |
| Then repeated to the end of the record: | ||
| Line number | 2 | The source line |
| Offset | 2 or 4 | Where the line starts in the segment |
Rules from the TIS OMF specification (the record is Microsoft-specific and “will be revised in future versions”): the Base Group field is ignored and the Base Segment must be non-zero (the full Intel 8086 specification allows a group or an absolute segment, but linkers such as Microsoft LINK restrict it to relocatable segments). For Microsoft LINNUM records the Line Number is a 16-bit quantity in the range 0 to 7FFF; the offset is the start byte of the translated code or data in the segment, 4 bytes in a 95 record and 2 in a 94 record. The pairs can repeat, so one record can give many lines of one segment. Line number 0 is special: it marks the offset of the first byte after the end of the function, so the length of the last line can be found. The source file is the one named by the THEADR record. A LINNUM must come after the SEGDEF it refers to and is usually near the end of the module. For instantiated inline functions in Microsoft C 7.0 the line numbers go in LINSYM records. The INCDEF comment (class A0, subtype 03) maintains line numbers after incremental compilation. Example: 94 0F 00 00 01 02 00 00 00 03 00 08 00 04 00 0F 00 3C gives lines 2, 3 and 4 at offsets 0, 8 and 0x0F of the first segment.
LINSYM (0xC4, 0xC5)
Line numbers for code in a COMDAT:
| Field | Size | Meaning |
|---|---|---|
| Flags | 1 | Bit 0: continuation of the COMDAT before |
| Public name | index | The COMDAT’s logical name |
| Then line number and offset pairs, as in LINNUM. | ||
The continuation bit: if clear, the record starts a new instance of the COMDAT symbol; if set, it continues the previous one. The Public Name Index is a regular logical name index naming the base. The line number is unsigned, 0 to 65,535, and the offset is relative to the base symbol; 4 bytes in a C5 record and 2 in a C4. A LINSYM follows the COMDAT it refers to, belongs to the most recent COMDAT of that symbol, and inherits its “localness”. When the linker meets several LINSYM records with matching names (several COMDATs of the same name) it keeps the one belonging to the retained COMDAT, which is how duplicate line information is discarded. Compilers write LINSYM because the segment and offset of such functions are unknown at compile time.