@@ -291,64 +291,91 @@ internal static IDiaSymbol TryGetDiaFunctionSymbol(DkmNativeModuleInstance modul
291
291
292
292
internal static ulong ? TryGetFunctionAddress ( DkmNativeModuleInstance moduleInstance , string name , out string error )
293
293
{
294
- var functionSymbol = TryGetDiaFunctionSymbol ( moduleInstance , name , out error ) ;
294
+ try
295
+ {
296
+ var functionSymbol = TryGetDiaFunctionSymbol ( moduleInstance , name , out error ) ;
295
297
296
- if ( functionSymbol == null )
297
- return null ;
298
+ if ( functionSymbol == null )
299
+ return null ;
298
300
299
- uint rva = functionSymbol . relativeVirtualAddress ;
301
+ uint rva = functionSymbol . relativeVirtualAddress ;
300
302
301
- ReleaseComObject ( functionSymbol ) ;
303
+ ReleaseComObject ( functionSymbol ) ;
302
304
303
- return moduleInstance . BaseAddress + rva ;
305
+ return moduleInstance . BaseAddress + rva ;
306
+ }
307
+ catch ( Exception ex )
308
+ {
309
+ error = "TryGetFunctionAddress() Unexpected error: " + ex . ToString ( ) ;
310
+ }
311
+
312
+ return null ;
304
313
}
305
314
306
315
internal static ulong ? TryGetFunctionAddressAtDebugStart ( DkmNativeModuleInstance moduleInstance , string name , out string error )
307
316
{
308
- var functionSymbol = TryGetDiaFunctionSymbol ( moduleInstance , name , out error ) ;
317
+ try
318
+ {
319
+ var functionSymbol = TryGetDiaFunctionSymbol ( moduleInstance , name , out error ) ;
309
320
310
- if ( functionSymbol == null )
311
- return null ;
321
+ if ( functionSymbol == null )
322
+ return null ;
312
323
313
- var functionStartSymbol = TryGetDiaSymbol ( functionSymbol , SymTagEnum . SymTagFuncDebugStart , null , out error ) ;
324
+ var functionStartSymbol = TryGetDiaSymbol ( functionSymbol , SymTagEnum . SymTagFuncDebugStart , null , out error ) ;
314
325
315
- if ( functionStartSymbol == null )
316
- {
317
- ReleaseComObject ( functionSymbol ) ;
326
+ if ( functionStartSymbol == null )
327
+ {
328
+ ReleaseComObject ( functionSymbol ) ;
318
329
319
- return null ;
320
- }
330
+ return null ;
331
+ }
332
+
333
+ uint rva = functionStartSymbol . relativeVirtualAddress ;
321
334
322
- uint rva = functionStartSymbol . relativeVirtualAddress ;
335
+ ReleaseComObject ( functionStartSymbol ) ;
336
+ ReleaseComObject ( functionSymbol ) ;
323
337
324
- ReleaseComObject ( functionStartSymbol ) ;
325
- ReleaseComObject ( functionSymbol ) ;
338
+ return moduleInstance . BaseAddress + rva ;
339
+ }
340
+ catch ( Exception ex )
341
+ {
342
+ error = "TryGetFunctionAddressAtDebugStart() Unexpected error: " + ex . ToString ( ) ;
343
+ }
326
344
327
- return moduleInstance . BaseAddress + rva ;
345
+ return null ;
328
346
}
329
347
330
348
internal static ulong ? TryGetFunctionAddressAtDebugEnd ( DkmNativeModuleInstance moduleInstance , string name , out string error )
331
349
{
332
- var functionSymbol = TryGetDiaFunctionSymbol ( moduleInstance , name , out error ) ;
350
+ try
351
+ {
352
+ var functionSymbol = TryGetDiaFunctionSymbol ( moduleInstance , name , out error ) ;
333
353
334
- if ( functionSymbol == null )
335
- return null ;
354
+ if ( functionSymbol == null )
355
+ return null ;
336
356
337
- var functionEndSymbol = TryGetDiaSymbol ( functionSymbol , SymTagEnum . SymTagFuncDebugEnd , null , out error ) ;
357
+ var functionEndSymbol = TryGetDiaSymbol ( functionSymbol , SymTagEnum . SymTagFuncDebugEnd , null , out error ) ;
338
358
339
- if ( functionEndSymbol == null )
340
- {
341
- ReleaseComObject ( functionSymbol ) ;
359
+ if ( functionEndSymbol == null )
360
+ {
361
+ ReleaseComObject ( functionSymbol ) ;
342
362
343
- return null ;
344
- }
363
+ return null ;
364
+ }
365
+
366
+ uint rva = functionEndSymbol . relativeVirtualAddress ;
345
367
346
- uint rva = functionEndSymbol . relativeVirtualAddress ;
368
+ ReleaseComObject ( functionEndSymbol ) ;
369
+ ReleaseComObject ( functionSymbol ) ;
347
370
348
- ReleaseComObject ( functionEndSymbol ) ;
349
- ReleaseComObject ( functionSymbol ) ;
371
+ return moduleInstance . BaseAddress + rva ;
372
+ }
373
+ catch ( Exception ex )
374
+ {
375
+ error = "TryGetFunctionAddressAtDebugEnd() Unexpected error: " + ex . ToString ( ) ;
376
+ }
350
377
351
- return moduleInstance . BaseAddress + rva ;
378
+ return null ;
352
379
}
353
380
354
381
internal static Guid ? CreateHelperFunctionBreakpoint ( DkmNativeModuleInstance nativeModuleInstance , string functionName )
0 commit comments