Debugging Tools for Windows

GetOffsetByLine

The GetOffsetByLine and GetOffsetByLineWide methods return the location of the instruction that corresponds to a specified line in the source code.

IDebugSymbols::GetOffsetByLine(
    IN ULONG  Line,
    IN PCSTR  File,
    OUT PULONG64  Offset
    );

IdebugSymbols3::GetOffsetByLineWide(
    IN ULONG  Line,
    IN PCWSTR  File,
    OUT PULONG64  Offset
    );

#ifdef UNICODE
#define GetOffsetByLineT GetOffsetByLineWide
#else
#define GetOffsetByLineT GetOffsetByLine
#endif

Parameters

Line
Specifies the line number in the source file.
File
Specifies the file name of the source file.
Offset
Receives the location in the target’s virtual address space of an instruction for the specified line.

Return Value

S_OK
The method was successful.

These methods can also return error values. See Return Values for more details.

Interface Version

GetOffsetByLine is available in all versions of IDebugSymbols. GetOffsetByLineWide is available in IDebugSymbols3 and later versions.

Comments

A line in a source file might correspond to multiple instructions and this method can return any one of these instructions.

For more information about source files, see Using Source Files.

Requirements

Headers: Defined in Dbgeng.h. Include Dbgeng.h.

See Also

GetLineByOffset

Build machine: CAPEBUILD