Expand Minimize

SymGetLineFromName64 function

Locates a source line for the specified module, file name, and line number.

Syntax


BOOL WINAPI SymGetLineFromName64(
  _In_      HANDLE hProcess,
  _In_opt_  PCTSTR ModuleName,
  _In_opt_  PCTSTR FileName,
  _In_      DWORD dwLineNumber,
  _Out_     PLONG lpDisplacement,
  _Inout_   PIMAGEHLP_LINE64 Line
);

Parameters

hProcess [in]

A handle to the process that was originally passed to the SymInitialize function.

ModuleName [in, optional]

The name of the module in which a line is to be located.

FileName [in, optional]

The name of the file in which a line is to be located. If the application has more than one source file with this name, be sure to specify a full path.

dwLineNumber [in]

The line number to be located.

lpDisplacement [out]

The displacement in bytes from the beginning of the line, or zero.

Line [in, out]

A pointer to an IMAGEHLP_LINE64 structure.

Return value

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError.

Remarks

The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before calling SymGetLineFromName64.

Before calling this function, ensure that the symbols are initialized correctly by first calling SymInitialize, SymSetOptions, and SymLoadModule64.

This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned to another buffer immediately.

All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromNameW64 is defined as follows in Dbghelp.h.



BOOL
IMAGEAPI
SymGetLineFromNameW64(
    __in HANDLE hProcess,
    __in_opt PCWSTR ModuleName,
    __in_opt PCWSTR FileName,
    __in DWORD dwLineNumber,
    __out PLONG plDisplacement,
    __inout PIMAGEHLP_LINEW64 Line
    );

#ifdef DBGHELP_TRANSLATE_TCHAR
#define SymGetLineFromName64   SymGetLineFromNameW64
#endif

This function supersedes the SymGetLineFromName function. For more information, see Updated Platform Support. SymGetLineFromName is defined as follows in Dbghelp.h.


#if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
#define SymGetLineFromName SymGetLineFromName64
#else
BOOL
IMAGEAPI
SymGetLineFromName(
    __in HANDLE hProcess,
    __in_opt PCSTR ModuleName,
    __in_opt PCSTR FileName,
    __in DWORD dwLineNumber,
    __out PLONG plDisplacement,
    __inout PIMAGEHLP_LINE Line
    );
#endif

Examples

For an example, see Retrieving Symbol Information by Name.

Requirements

Redistributable

DbgHelp.dll 5.1 or later

Header

Dbghelp.h

Library

Dbghelp.lib

DLL

Dbghelp.dll

Unicode and ANSI names

SymGetLineFromNameW64 (Unicode) and SymGetLineFromName64 (ANSI)

See also

DbgHelp Functions
IMAGEHLP_LINE64
SymGetLineFromAddr64
SymInitialize

 

 

Community Additions

ADD
Show:
© 2014 Microsoft