Debugging Tools for Windows

GetLineByOffset

The GetLineByOffset and GetLineByOffsetWide methods return the source filename and the line number within the source file of an instruction in the target.

IDebugSymbols::GetLineByOffset(
    IN ULONG64  Offset,
    OUT OPTIONAL PULONG  Line,
    OUT OPTIONAL PSTR  FileBuffer,
    IN ULONG  FileBufferSize,
    OUT OPTIONAL PULONG  FileSize,
    OUT OPTIONAL PULONG64  Displacement
    );

IdebugSymbols3::GetLineByOffsetWide(
    IN ULONG64  Offset,
    OUT OPTIONAL PULONG  Line,
    OUT OPTIONAL PWSTR  FileBuffer,
    IN ULONG  FileBufferSize,
    OUT OPTIONAL PULONG  FileSize,
    OUT OPTIONAL PULONG64  Displacement
    );

#ifdef UNICODE
#define GetLineByOffsetT GetLineByOffsetWide
#else
#define GetLineByOffsetT GetLineByOffset
#endif

Parameters

Offset
Specifies the location in the target’s virtual address space of the instruction for which to return the source file and line number.
Line
Receives the line number within the source file of the instruction specified by Offset. If Line is NULL, this information is not returned.
FileBuffer
Receives the file name of the file that contains the instruction specified by Offset. If FileBuffer is NULL, this information is not returned.
FileBufferSize
Specifies the size, in characters, of the FileBuffer buffer.
FileSize
Specifies the size, in characters, of the source filename. If FileSize is NULL, this information is not returned.
Displacement
Receives the difference between the location specified in Offset and the location of the first instruction of the returned line. If Displacement is NULL, this information is not returned.

Return Value

S_OK
The method was successful.
S_FALSE
The method was successful. However, the buffer was not large enough to hold the name of the source file and the name was truncated.

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

Interface Version

GetLineByOffset is available in all versions of IDebugSymbols. GetLineByOffsetWide is available in IDebugSymbols3 and later versions.

Comments

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

Requirements

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

See Also

GetOffsetByLine

Build machine: CAPEBUILD