@@ -216,13 +216,6 @@ delegate bool SymGetHomeDirectoryW(
216
216
[ In , Out ] StringBuilder dir ,
217
217
IntPtr size
218
218
) ;
219
-
220
- [ UnmanagedFunctionPointer ( CallingConvention . StdCall , CharSet = CharSet . Unicode , SetLastError = true ) ]
221
- delegate bool SymGetDiaSession (
222
- SafeKernelObjectHandle hProcess ,
223
- long BaseOfDll ,
224
- [ MarshalAs ( UnmanagedType . Interface ) ] out IDiaSession DiaSession
225
- ) ;
226
219
227
220
private readonly SafeLoadLibraryHandle _dbghelp_lib ;
228
221
private readonly SymInitializeW _sym_init ;
@@ -246,7 +239,6 @@ delegate bool SymGetDiaSession(
246
239
private readonly SymSetContext _sym_set_context ;
247
240
private readonly SymEnumSymbolsW _sym_enum_symbols ;
248
241
private readonly SymGetHomeDirectoryW _sym_get_home_directory ;
249
- private readonly SymGetDiaSession _sym_get_dia_session ;
250
242
private IEnumerable < SymbolLoadedModule > _loaded_modules ;
251
243
private readonly TextWriter _trace_writer ;
252
244
private readonly bool _trace_symbol_loading ;
@@ -259,11 +251,6 @@ private void GetFunc<T>(ref T f) where T : Delegate
259
251
{
260
252
f = _dbghelp_lib . GetFunctionPointer < T > ( ) ;
261
253
}
262
-
263
- private void GetFuncNoThrow < T > ( ref T f ) where T : Delegate
264
- {
265
- f = _dbghelp_lib . GetFunctionPointer < T > ( false ) ;
266
- }
267
254
268
255
private void GetFunc < T > ( ref T f , string name ) where T : Delegate
269
256
{
@@ -280,29 +267,6 @@ private static string GetNameFromSymbolInfo(SafeStructureInOutBuffer<SYMBOL_INFO
280
267
return buffer . Data . ReadNulTerminatedUnicodeString ( ) ;
281
268
}
282
269
283
- private DllMachineType GetSymbolMachineType ( SYMBOL_INFO sym_info )
284
- {
285
- IDiaSession session = null ;
286
- IDiaSymbol symbol = null ;
287
- try
288
- {
289
- if ( _sym_get_dia_session == null || ! _sym_get_dia_session ( Handle , sym_info . ModBase , out session ) )
290
- return DllMachineType . UNKNOWN ;
291
-
292
- if ( session . findSymbolByVA ( sym_info . Address , sym_info . Tag , out symbol ) != 0 )
293
- return DllMachineType . UNKNOWN ;
294
-
295
- return ( DllMachineType ) symbol . machineType ;
296
- }
297
- finally
298
- {
299
- if ( symbol != null )
300
- Marshal . ReleaseComObject ( symbol ) ;
301
- if ( session != null )
302
- Marshal . ReleaseComObject ( session ) ;
303
- }
304
- }
305
-
306
270
private static SafeStructureInOutBuffer < SYMBOL_INFO > MapSymbolInfo ( IntPtr symbol_info )
307
271
{
308
272
int base_size = Marshal . SizeOf ( typeof ( SYMBOL_INFO ) ) ;
@@ -744,7 +708,7 @@ private DataSymbolInformation GetSymbolInfoForAddress(IntPtr address)
744
708
745
709
return new DataSymbolInformation ( result . Tag , result . Size , result . TypeIndex ,
746
710
result . Address , GetModuleForAddress ( new IntPtr ( result . ModBase ) ) ,
747
- GetNameFromSymbolInfo ( sym_info ) , GetSymbolMachineType ( result ) ) ;
711
+ GetNameFromSymbolInfo ( sym_info ) , ( DllMachineType ) result . Reserved2 ) ;
748
712
}
749
713
750
714
return null ;
@@ -762,7 +726,7 @@ private DataSymbolInformation GetSymbolInfoForName(string name)
762
726
var result = sym_info . Result ;
763
727
return new DataSymbolInformation ( result . Tag , result . Size , result . TypeIndex ,
764
728
result . Address , GetModuleForAddress ( new IntPtr ( result . ModBase ) ) ,
765
- GetNameFromSymbolInfo ( sym_info ) , GetSymbolMachineType ( result ) ) ;
729
+ GetNameFromSymbolInfo ( sym_info ) , ( DllMachineType ) result . Reserved2 ) ;
766
730
}
767
731
}
768
732
@@ -897,7 +861,7 @@ private bool GetSymbolInfo(List<SymbolInformation> symbols, IntPtr symbol_info,
897
861
var result = sym_info . Result ;
898
862
var symbol = new DataSymbolInformation ( result . Tag , result . Size , result . TypeIndex ,
899
863
result . Address , GetModuleForAddress ( new IntPtr ( result . ModBase ) ) ,
900
- GetNameFromSymbolInfo ( sym_info ) , GetSymbolMachineType ( result ) ) ;
864
+ GetNameFromSymbolInfo ( sym_info ) , ( DllMachineType ) result . Reserved2 ) ;
901
865
symbols . Add ( symbol ) ;
902
866
return true ;
903
867
}
@@ -1158,7 +1122,6 @@ internal DbgHelpSymbolResolver(NtProcess process, string dbghelp_path, string sy
1158
1122
GetFunc ( ref _sym_enum_symbols ) ;
1159
1123
GetFunc ( ref _sym_set_context ) ;
1160
1124
GetFunc ( ref _sym_get_home_directory ) ;
1161
- GetFuncNoThrow ( ref _sym_get_dia_session ) ;
1162
1125
1163
1126
_trace_writer = trace_writer ?? new TraceTextWriter ( ) ;
1164
1127
SymOptions options = SymOptions . INCLUDE_32BIT_MODULES | SymOptions . UNDNAME | SymOptions . DEFERRED_LOADS ;
0 commit comments