1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5
6
7#ifndef __SOURCELINE_H__
8#define __SOURCELINE_H__
9
10#ifdef ENABLE_DIAGNOSTIC_SYMBOL_READING
11#include "dia2.h"
12#endif // ENABLE_DIAGNOSTIC_SYMBOL_READING
13
14#define CComPtr(x) x*
15
16class SourceLine
17{
18 bool initialized_;
19
20#ifdef ENABLE_DIAGNOSTIC_SYMBOL_READING
21 CComPtr(IDiaDataSource) pSource_;
22 CComPtr(IDiaSymbol) pGlobal_;
23 CComPtr(IDiaSession) pSession_;
24
25 bool LoadDataFromPdb( __in_z LPWSTR wszFilename );
26#endif // ENABLE_DIAGNOSTIC_SYMBOL_READING
27
28public:
29 SourceLine( __in_z LPWSTR pszFileName );
30
31 bool IsInitialized() { return initialized_; }
32
33 //
34 // Given function token (methoddef) and offset, return filename and line number
35 //
36 HRESULT GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_ecount(dwFileNameMaxLen) __out_z LPWSTR wszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber );
37
38 //
39 // Given function token (methoddef) and slot, return name of the local variable
40 //
41 HRESULT GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_ecount(dwNameMaxLen) __out_z LPWSTR wszName, DWORD dwNameMaxLen );
42};
43
44#endif // __SOURCELINE_H__
45