-
-
[原创]Debuggervisualizer+ILReader+ Dynamically Generated Code
-
发表于: 2010-10-17 20:08 1784
-
DebuggerVisualizer for DynamicMethod (Show me the IL)
+ all refering articles + sources + binaries
(1) DebuggerVisualizer for DynamicMethod (Show me the IL)
(2) Hello World - LCG (Lightweight Code Gen) style
(3) Latebound invocation CallVirt-Delegates-DynamicMethod-InvokeMember
(4) System.Reflection-based ILReader
(5) Read IL from MethodBody
(6) Turn MethodInfo to DynamicMethod
(7) Hello World with DynamicILInfo
(8.1) Take Two - IL Visualizer
(8.2) Debugger Visualizer for MethodInfo - DynamicMethod - MethodBase
(9) Debugging Dynamically Generated Code (Reflection.Emit)
(10) Hello World - Reflection.Emit style
(11) DebuggableAttribute and dynamic assemblies
(12) SignatureResolver (unfinished)
_SOURCES_
btw rename .pdf to rar !!!!
How to write a Virtualizer (msdn)
All Credz to : Haibo_Luo and Joel Pobar <---- amazing .NET guys !!!
Have you ever tried DynamicMethod, one of the coolest features in the .NET 2.0? Hope you have; otherwise, you can try it now with the examples 1, 2.
Like emitting IL to MethodBuilder, we first get ILGenerator from a DynamicMethod, and make a series of ILGenerator.Emit calls to emit the IL instructions. If the emit sequence/logic is complicated, we are likely to wanna check the on-the-fly IL content when debugging. (In fact, class DynamicILInfo provides an alternative way to set the IL code for dynamic method.)
It is not straightforward to find out this information and show it. Those instructions are stored in a byte array, so we need an ILReader to parse it; if the ILDasm-style output is preferred, we need to resolve type/field/method back from tokens (DynamicMethod has its own token management mechanism). By the way, Yiru wrote an excellent post "Debugging LCG", where windbg + SOS were used, and !dumpil was called with the DynamicMethod's MethodDesc (which is not available until jit'ting)
What if we want to live with the nice-looking Visual Studio 2005 environment, and still be able to see what has been emitted by far while we are debugging the dynamic method? Peli (our CLR team member and also an active Emit/LCG user) proposed that DebuggerVisualizer is a good solution. If you are interested in DebuggerVisualizer in general, some references can be found at Scott's blog (or msdn: how to write a visualizer)
+ all refering articles + sources + binaries
(1) DebuggerVisualizer for DynamicMethod (Show me the IL)
(2) Hello World - LCG (Lightweight Code Gen) style
(3) Latebound invocation CallVirt-Delegates-DynamicMethod-InvokeMember
(4) System.Reflection-based ILReader
(5) Read IL from MethodBody
(6) Turn MethodInfo to DynamicMethod
(7) Hello World with DynamicILInfo
(8.1) Take Two - IL Visualizer
(8.2) Debugger Visualizer for MethodInfo - DynamicMethod - MethodBase
(9) Debugging Dynamically Generated Code (Reflection.Emit)
(10) Hello World - Reflection.Emit style
(11) DebuggableAttribute and dynamic assemblies
(12) SignatureResolver (unfinished)
_SOURCES_
btw rename .pdf to rar !!!!
How to write a Virtualizer (msdn)
All Credz to : Haibo_Luo and Joel Pobar <---- amazing .NET guys !!!
Have you ever tried DynamicMethod, one of the coolest features in the .NET 2.0? Hope you have; otherwise, you can try it now with the examples 1, 2.
Like emitting IL to MethodBuilder, we first get ILGenerator from a DynamicMethod, and make a series of ILGenerator.Emit calls to emit the IL instructions. If the emit sequence/logic is complicated, we are likely to wanna check the on-the-fly IL content when debugging. (In fact, class DynamicILInfo provides an alternative way to set the IL code for dynamic method.)
It is not straightforward to find out this information and show it. Those instructions are stored in a byte array, so we need an ILReader to parse it; if the ILDasm-style output is preferred, we need to resolve type/field/method back from tokens (DynamicMethod has its own token management mechanism). By the way, Yiru wrote an excellent post "Debugging LCG", where windbg + SOS were used, and !dumpil was called with the DynamicMethod's MethodDesc (which is not available until jit'ting)
What if we want to live with the nice-looking Visual Studio 2005 environment, and still be able to see what has been emitted by far while we are debugging the dynamic method? Peli (our CLR team member and also an active Emit/LCG user) proposed that DebuggerVisualizer is a good solution. If you are interested in DebuggerVisualizer in general, some references can be found at Scott's blog (or msdn: how to write a visualizer)
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
赞赏
他的文章
看原图
赞赏
雪币:
留言: