Returns a set of file names and line numbers given a set of function addresses. A symbol proxy must be set up using xbSymbolProxy.exe before calling GetSourceLineFromAddress.
HRESULT GetSourceLineFromAddress(
ResolveDisposition Disposition,
DWORD RequestCount,
ULONG_PTR []Address,
GETSRCPATH_PROC Callback,
LPVOID Context
)
Disposition
Type: ResolveDisposition
[in] Describes search preferences for source file and line number resolution. This parameter is provided for future expansion. Only ResolveDisposition::DefaultPriority is currently supported.
RequestCount
Type: DWORD
[in] The number of addresses supplied in the Address parameter.
Address
Type: ULONG_PTR []
[in] An array of addresses for which to resolve file name and line number information.
Callback
Type: GETSRCPATH_PROC
[in] A callback that will be called once for each address passed in using the Address array. The parameters to this callback provide the results of the file name and line number resolution.
Context
Type: LPVOID
[in] User supplied context that will be passed as a parameter to Callback.
Type: HRESULT
Indicates whether the resolution process was completed successfully. S_OK is returned on success. Note that this value indicates only whether the process of attempting to resolve the file names and line numbers was successful. This value does not indicate whether source line information was actually found for each address specified. The result parameter to the Callback indicates whether or not source line information was returned.
This function attempts to obtain source file information given a set of function addresses in your title. This capability is useful for generating callstacks that contain full symbol information when errors occur in your title, for example.
Before calling this API you must use the xbSymbolProxy.exe command line tool to configure a PC as a symbol proxy. xbSymbolProxy.exe is used to establish a connection between your console and your PC and to specify the location of your title’s PDBs on a PC or a symbol server that can be accessed from your PC.
BOOL SrcCallback
(
LPVOID context,
ULONG_PTR address,
HRESULT result,
PCWSTR filepath,
ULONG linenumber
)
{
// the filepath and line number parameters to this callback provide the source file information for a supplied function address.
return TRUE;
}
ULONG_PTR addresses[] =
{
(ULONG_PTR)myTitleFunction
};
HRESULT hr = GetSourceLineFromAddress(
ResolveDisposition::DefaultPriority,
_countof(addresses),
addresses,
SrcCallback,
this);
Header: Declared in SymbolResolve.h.
Library: Use toolhelpx.lib.