2
2
using Microsoft . VisualStudio . Debugger ;
3
3
using Microsoft . VisualStudio . Debugger . CallStack ;
4
4
using Microsoft . VisualStudio . Debugger . Evaluation ;
5
+ using Microsoft . VisualStudio . Debugger . Native ;
5
6
6
7
namespace PmipMyCallStack
7
8
{
8
9
class PmipRunner
9
10
{
10
11
private static readonly DkmLanguage CppLanguage = DkmLanguage . Create ( "C++" , new DkmCompilerId ( DkmVendorId . Microsoft , DkmLanguageId . Cpp ) ) ;
11
- private static readonly string [ ] Modules = { "mono" , "monosgen-2.0" } ;
12
12
13
13
private readonly DkmStackContext _stackContext ;
14
14
private readonly DkmStackWalkFrame _frame ;
@@ -59,14 +59,12 @@ private bool TryGetPmipFunction(out PmipFunctionDataItem pmipFunction)
59
59
if ( pmipFunction != null )
60
60
return true ;
61
61
62
- foreach ( var module in Modules )
62
+ foreach ( var module in this . _frame . RuntimeInstance . GetModuleInstances ( ) )
63
63
{
64
- var definition = $ "{{,,{ module } }}mono_pmip";
65
-
66
- PmipFunctionDataItem item = null ;
67
- if ( ! EvaluateExpression ( definition , r => item = new PmipFunctionDataItem { PmipFunction = definition } ) )
64
+ var address = ( module as DkmNativeModuleInstance ) ? . FindExportName ( "mono_pmip" , IgnoreDataExports : true ) ;
65
+ if ( address == null )
68
66
continue ;
69
-
67
+ var item = new PmipFunctionDataItem { PmipFunction = "0x" + address . CPUInstructionPart . InstructionPointer . ToString ( "X" ) } ;
70
68
pmipFunction = item ;
71
69
_stackContext . SetDataItem ( DkmDataCreationDisposition . CreateAlways , item ) ;
72
70
return true ;
@@ -116,4 +114,4 @@ private bool EvaluateExpression(string expression, Action<DkmSuccessEvaluationRe
116
114
return success ;
117
115
}
118
116
}
119
- }
117
+ }
0 commit comments