1 //===- DIASymbol.h - Dump debug info from a PDB file ------------*- C++ -*-===//
\r
3 // The LLVM Compiler Infrastructure
\r
5 // This file is distributed under the University of Illinois Open Source
\r
6 // License. See LICENSE.TXT for details.
\r
8 //===----------------------------------------------------------------------===//
\r
10 // Provides a wrapper around the IDiaSymbol interface. IDiaSymbol is used to
\r
11 // represent any kind of symbol from functions, to compilands, to source files.
\r
12 // It provides a monolithic interface of close to 200 operations, and the set
\r
13 // of operations that are valid depends on the type of the symbol. Since it is
\r
14 // not clearly documented which set of operations is valid for which type of
\r
15 // symbol, the best way of figuring it out is to dump every method for every
\r
16 // symbol, and see which methods return errors. This wrapper provides a clean
\r
17 // way of doing this without involving needing to embed lots of unsightly
\r
18 // HRESULT checking at every callsite.
\r
20 //===----------------------------------------------------------------------===//
\r
22 #ifndef LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
\r
23 #define LLVM_TOOLS_LLVMPDBDUMP_DIASYMBOL_H
\r
25 #include "DIAExtras.h"
\r
26 #include "llvm/ADT/SmallString.h"
\r
34 DIASymbol(IDiaSymbol *DiaSymbol);
\r
37 /// Dumps the value of every property (if it exists) with a default name.
\r
38 /// This is useful for understanding what symbol types support what methods
\r
39 /// during development time.
\r
40 void fullDump(int IndentLevel);
\r
42 // TODO: The following methods are present on IDiaSymbol but do not yet have
\r
45 // HRESULT get_value(VARIANT *pRetVal) = 0;
\r
46 // HRESULT get_undecoratedNameEx(DWORD undecorateOptions, BSTR *name) = 0;
\r
47 // HRESULT getSrcLineOnTypeDefn(IDiaLineNumber **ppResult) = 0;
\r
48 // HRESULT get_dataBytes(DWORD cbData, DWORD *pcbData, BYTE *pbData) = 0;
\r
49 // HRESULT get_types(DWORD cTypes, DWORD *pcTypes, IDiaSymbol **pTypes) = 0;
\r
50 // HRESULT get_typeIds(DWORD cTypeIds, DWORD *pcTypeIds, DWORD *pdwTypeIds) = 0;
\r
51 // HRESULT get_numericProperties(DWORD cnt, DWORD *pcnt,
\r
52 // DWORD *pProperties) = 0;
\r
53 // HRESULT get_modifierValues(DWORD cnt, DWORD *pcnt, WORD *pModifiers) = 0;
\r
54 // HRESULT get_acceleratorPointerTags(DWORD cnt, DWORD *pcnt, DWORD
\r
55 // *pPointerTags) = 0;
\r
56 // HRESULT get_hfaFloat(BOOL *pRetVal) = 0;
\r
57 // HRESULT get_hfaDouble(BOOL *pRetVal) = 0;
\r
58 // HRESULT get_paramBasePointerRegisterId(DWORD *pRetVal) = 0;
\r
59 // HRESULT get_isWinRTPointer(BOOL *pRetVal) = 0;
\r
61 #if (_MSC_FULL_VER >= 180031101)
\r
62 // These methods are only available on VS 2013 SP 4 and higher.
\r
63 DIAResult<BOOL> isPGO();
\r
64 DIAResult<BOOL> hasValidPGOCounts();
\r
65 DIAResult<BOOL> isOptimizedForSpeed();
\r
66 DIAResult<DWORD> getPGOEntryCount();
\r
67 DIAResult<DWORD> getPGOEdgeCount();
\r
68 DIAResult<ULONGLONG> getPGODynamicInstructionCount();
\r
69 DIAResult<DWORD> getStaticSize();
\r
70 DIAResult<DWORD> getFinalLiveStaticSize();
\r
71 DIAResult<DIAString> getPhaseName();
\r
72 DIAResult<BOOL> hasControlFlowCheck();
\r
75 DIAResult<DiaSymbolPtr> getLexicalParent();
\r
76 DIAResult<DiaSymbolPtr> getClassParent();
\r
77 DIAResult<DiaSymbolPtr> getType();
\r
78 DIAResult<DiaSymbolPtr> getArrayIndexType();
\r
79 DIAResult<DiaSymbolPtr> getVirtualTableShape();
\r
80 DIAResult<DiaSymbolPtr> getLowerBound();
\r
81 DIAResult<DiaSymbolPtr> getUpperBound();
\r
82 DIAResult<DiaSymbolPtr> getObjectPointerType();
\r
83 DIAResult<DiaSymbolPtr> getContainer();
\r
84 DIAResult<DiaSymbolPtr> getVirtualBaseTableType();
\r
85 DIAResult<DiaSymbolPtr> getUnmodifiedType();
\r
86 DIAResult<DiaSymbolPtr> getSubType();
\r
87 DIAResult<DiaSymbolPtr> getBaseSymbol();
\r
89 DIAResult<DWORD> getAccess();
\r
90 DIAResult<DWORD> getAddressOffset();
\r
91 DIAResult<DWORD> getAddressSection();
\r
92 DIAResult<DWORD> getAge();
\r
93 DIAResult<DWORD> getArrayIndexTypeId();
\r
94 DIAResult<DWORD> getBackEndBuild();
\r
95 DIAResult<DWORD> getBackEndMajor();
\r
96 DIAResult<DWORD> getBackEndMinor();
\r
97 DIAResult<DWORD> getBackEndQFE();
\r
98 DIAResult<DWORD> getBaseDataOffset();
\r
99 DIAResult<DWORD> getBaseDataSlot();
\r
100 DIAResult<DWORD> getBaseSymbolId();
\r
101 DIAResult<DWORD> getBaseType();
\r
102 DIAResult<DWORD> getBitPosition();
\r
103 DIAResult<DWORD> getBuiltInKind();
\r
104 DIAResult<CV_call_e> getCallingConvention();
\r
105 DIAResult<DWORD> getClassParentId();
\r
106 DIAResult<DIAString> getCompilerName();
\r
107 DIAResult<DWORD> getCount();
\r
108 DIAResult<DWORD> getCountLiveRanges();
\r
109 DIAResult<DWORD> getFrontEndBuild();
\r
110 DIAResult<DWORD> getFrontEndMajor();
\r
111 DIAResult<DWORD> getFrontEndMinor();
\r
112 DIAResult<DWORD> getFrontEndQFE();
\r
113 DIAResult<CV_CFL_LANG> getLanguage();
\r
114 DIAResult<DWORD> getLexicalParentId();
\r
115 DIAResult<DIAString> getLibraryName();
\r
116 DIAResult<DWORD> getLiveRangeStartAddressOffset();
\r
117 DIAResult<DWORD> getLiveRangeStartAddressSection();
\r
118 DIAResult<DWORD> getLiveRangeStartRelativeVirtualAddress();
\r
119 DIAResult<DWORD> getLocalBasePointerRegisterId();
\r
120 DIAResult<DWORD> getLowerBoundId();
\r
121 DIAResult<DWORD> getMemorySpaceKind();
\r
122 DIAResult<DIAString> getName();
\r
123 DIAResult<DWORD> getNumberOfAcceleratorPointerTags();
\r
124 DIAResult<DWORD> getNumberOfColumns();
\r
125 DIAResult<DWORD> getNumberOfModifiers();
\r
126 DIAResult<DWORD> getNumberOfRegisterIndices();
\r
127 DIAResult<DWORD> getNumberOfRows();
\r
128 DIAResult<DIAString> getObjectFileName();
\r
129 DIAResult<DWORD> getOemSymbolId();
\r
130 DIAResult<DWORD> getOffsetInUdt();
\r
131 DIAResult<CV_CPU_TYPE_e> getPlatform();
\r
132 DIAResult<DWORD> getRank();
\r
133 DIAResult<DWORD> getRegisterId();
\r
134 DIAResult<DWORD> getRegisterType();
\r
135 DIAResult<DWORD> getRelativeVirtualAddress();
\r
136 DIAResult<DWORD> getSamplerSlot();
\r
137 DIAResult<DWORD> getSignature();
\r
138 DIAResult<DWORD> getSizeInUdt();
\r
139 DIAResult<DWORD> getSlot();
\r
140 DIAResult<DIAString> getSourceFileName();
\r
141 DIAResult<DWORD> getStride();
\r
142 DIAResult<DWORD> getSubTypeId();
\r
143 DIAResult<DIAString> getSymbolsFileName();
\r
144 DIAResult<DWORD> getSymIndexId();
\r
145 DIAResult<DWORD> getTargetOffset();
\r
146 DIAResult<DWORD> getTargetRelativeVirtualAddress();
\r
147 DIAResult<DWORD> getTargetSection();
\r
148 DIAResult<DWORD> getTextureSlot();
\r
149 DIAResult<DWORD> getTimeStamp();
\r
150 DIAResult<DWORD> getToken();
\r
151 DIAResult<DWORD> getUavSlot();
\r
152 DIAResult<DIAString> getUndecoratedName();
\r
153 DIAResult<DWORD> getUnmodifiedTypeId();
\r
154 DIAResult<DWORD> getUpperBoundId();
\r
155 DIAResult<DWORD> getVirtualBaseDispIndex();
\r
156 DIAResult<DWORD> getVirtualBaseOffset();
\r
157 DIAResult<DWORD> getVirtualTableShapeId();
\r
158 DIAResult<DataKind> getDataKind();
\r
159 DIAResult<DiaSymTagEnum> getSymTag();
\r
160 DIAResult<GUID> getGuid();
\r
161 DIAResult<LONG> getOffset();
\r
162 DIAResult<LONG> getThisAdjust();
\r
163 DIAResult<LONG> getVirtualBasePointerOffset();
\r
164 DIAResult<LocationType> getLocationType();
\r
165 DIAResult<MachineTypeEnum> getMachineType();
\r
166 DIAResult<THUNK_ORDINAL> getThunkOrdinal();
\r
167 DIAResult<ULONGLONG> getLength();
\r
168 DIAResult<ULONGLONG> getLiveRangeLength();
\r
169 DIAResult<ULONGLONG> getTargetVirtualAddress();
\r
170 DIAResult<ULONGLONG> getVirtualAddress();
\r
171 DIAResult<UdtKind> getUdtKind();
\r
172 DIAResult<BOOL> hasConstructor();
\r
173 DIAResult<BOOL> hasCustomCallingConvention();
\r
174 DIAResult<BOOL> hasFarReturn();
\r
175 DIAResult<BOOL> isCode();
\r
176 DIAResult<BOOL> isCompilerGenerated();
\r
177 DIAResult<BOOL> isConstType();
\r
178 DIAResult<BOOL> isEditAndContinueEnabled();
\r
179 DIAResult<BOOL> isFunction();
\r
180 DIAResult<BOOL> getAddressTaken();
\r
181 DIAResult<BOOL> getNoStackOrdering();
\r
182 DIAResult<BOOL> hasAlloca();
\r
183 DIAResult<BOOL> hasAssignmentOperator();
\r
184 DIAResult<BOOL> hasCTypes();
\r
185 DIAResult<BOOL> hasCastOperator();
\r
186 DIAResult<BOOL> hasDebugInfo();
\r
187 DIAResult<BOOL> hasEH();
\r
188 DIAResult<BOOL> hasEHa();
\r
189 DIAResult<BOOL> hasInlAsm();
\r
190 DIAResult<BOOL> hasInlineAttribute();
\r
191 DIAResult<BOOL> hasInterruptReturn();
\r
192 DIAResult<BOOL> hasLongJump();
\r
193 DIAResult<BOOL> hasManagedCode();
\r
194 DIAResult<BOOL> hasNestedTypes();
\r
195 DIAResult<BOOL> hasNoInlineAttribute();
\r
196 DIAResult<BOOL> hasNoReturnAttribute();
\r
197 DIAResult<BOOL> hasOptimizedCodeDebugInfo();
\r
198 DIAResult<BOOL> hasOverloadedOperator();
\r
199 DIAResult<BOOL> hasSEH();
\r
200 DIAResult<BOOL> hasSecurityChecks();
\r
201 DIAResult<BOOL> hasSetJump();
\r
202 DIAResult<BOOL> hasStrictGSCheck();
\r
203 DIAResult<BOOL> isAcceleratorGroupSharedLocal();
\r
204 DIAResult<BOOL> isAcceleratorPointerTagLiveRange();
\r
205 DIAResult<BOOL> isAcceleratorStubFunction();
\r
206 DIAResult<BOOL> isAggregated();
\r
207 DIAResult<BOOL> isBaseVirtualFunction();
\r
208 DIAResult<BOOL> isCVTCIL();
\r
209 DIAResult<BOOL> isConstructorVirtualBase();
\r
210 DIAResult<BOOL> isCxxReturnUdt();
\r
211 DIAResult<BOOL> isDataAligned();
\r
212 DIAResult<BOOL> isHLSLData();
\r
213 DIAResult<BOOL> isHotpatchable();
\r
214 DIAResult<BOOL> isIndirectVirtualBaseClass();
\r
215 DIAResult<BOOL> isInterfaceUdt();
\r
216 DIAResult<BOOL> isIntrinsic();
\r
217 DIAResult<BOOL> isLTCG();
\r
218 DIAResult<BOOL> isLocationControlFlowDependent();
\r
219 DIAResult<BOOL> isMSILNetmodule();
\r
220 DIAResult<BOOL> isManagedRef();
\r
221 DIAResult<BOOL> isMatrixRowMajor();
\r
222 DIAResult<BOOL> isMsilRef();
\r
223 DIAResult<BOOL> isMultipleInheritance();
\r
224 DIAResult<BOOL> isNaked();
\r
225 DIAResult<BOOL> isNested();
\r
226 DIAResult<BOOL> isOptimizedAway();
\r
227 DIAResult<BOOL> isPacked();
\r
228 DIAResult<BOOL> isPointerBasedOnSymbolValue();
\r
229 DIAResult<BOOL> isPointerToDataMember();
\r
230 DIAResult<BOOL> isPointerToMemberFunction();
\r
231 DIAResult<BOOL> isPureVirtual();
\r
232 DIAResult<BOOL> isRValueReference();
\r
233 DIAResult<BOOL> isRefUdt();
\r
234 DIAResult<BOOL> isReference();
\r
235 DIAResult<BOOL> isRestrictedType();
\r
236 DIAResult<BOOL> isReturnValue();
\r
237 DIAResult<BOOL> isSafeBuffers();
\r
238 DIAResult<BOOL> isScoped();
\r
239 DIAResult<BOOL> isSdl();
\r
240 DIAResult<BOOL> isSingleInheritance();
\r
241 DIAResult<BOOL> isSplitted();
\r
242 DIAResult<BOOL> isStatic();
\r
243 DIAResult<BOOL> isStripped();
\r
244 DIAResult<BOOL> isUnalignedType();
\r
245 DIAResult<BOOL> isUnreached();
\r
246 DIAResult<BOOL> isValueUdt();
\r
247 DIAResult<BOOL> isVirtual();
\r
248 DIAResult<BOOL> isVirtualBaseClass();
\r
249 DIAResult<BOOL> isVirtualInheritance();
\r
250 DIAResult<BOOL> isVolatileType();
\r
253 template <class T, class U = T>
\r
255 InternalGetDIAValue(HRESULT (__stdcall IDiaSymbol::*Method)(T *)) {
\r
257 if (S_OK == (Symbol->*Method)(&Value))
\r
258 return DIAResult<U>(U(Value));
\r
260 return DIAResult<U>();
\r
263 DIAResult<DIAString>
\r
264 InternalGetDIAStringValue(HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
\r
266 if (S_OK == (Symbol->*Method)(&String16)) {
\r
267 std::string String8;
\r
268 llvm::sys::windows::BSTRToUTF8(String16, String8);
\r
269 SysFreeString(String16);
\r
270 return DIAResult<DIAString>(DIAString(String8));
\r
272 return DIAResult<DIAString>();
\r
275 IDiaSymbol *Symbol;
\r
278 } // namespace windows
\r
280 } // namespace llvm
\r