首页
社区
课程
招聘
[求助]WINDBG调试.NET程序当JIT时得到方法名称的问题。
2011-5-31 17:09 6276

[求助]WINDBG调试.NET程序当JIT时得到方法名称的问题。

2011-5-31 17:09
6276
用WINDBG调试ASP.NET程序。断点下在JIT的compileMethod,能够根据结构得到IL代码及大小,但如何得到当前要JIT的方法名称呢?还请各位赐教,谢谢。

[培训]二进制漏洞攻防(第3期);满10人开班;模糊测试与工具使用二次开发;网络协议漏洞挖掘;Linux内核漏洞挖掘与利用;AOSP漏洞挖掘与利用;代码审计。

收藏
点赞0
打赏
分享
最新回复 (3)
雪    币: 1137
活跃值: (10)
能力值: ( LV7,RANK:100 )
在线值:
发帖
回帖
粉丝
dreamzgj 2 2011-5-31 17:21
2
0
mscorjit:7906114F mscorjit_CILJit__compileMethod:
mscorjit:7906114F push    ebp
mscorjit:79061150 mov     ebp, esp
mscorjit:79061152 sub     esp, 10h
mscorjit:79061155 push    dword ptr [ebp+14h]
mscorjit:79061158 mov     eax, [ebp+10h]
mscorjit:7906115B mov     ecx, [eax]
mscorjit:7906115D and     dword ptr [ebp-4], 0
mscorjit:79061161 and     dword ptr [ebp-0Ch], 0
这里到compileMethod了,一路F8,看到有一些pop的时候
debug010:00411F3E mov     [ebx+0Ch], edi
debug010:00411F41 mov     ecx, [esi+8]
debug010:00411F44 mov     [esi+8], eax
debug010:00411F47 mov     eax, ecx
debug010:00411F49 add     esp, 4
debug010:00411F4C pop     edx
debug010:00411F4D pop     ecx
debug010:00411F4E mov     esp, ebp
debug010:00411F50 pop     ebp
debug010:00411F51 add     esp, 4
debug010:00411F54 pop     edi
debug010:00411F55 pop     esi
debug010:00411F56 pop     ebx
debug010:00411F57 pop     ebp
debug010:00411F58 add     esp, 8
debug010:00411F5B retn
retn了就到了方法的汇编代码了
debug196:01230070 push    esi
debug196:01230071 cmp     dword_9C2E08, 0
debug196:01230078 jz      short loc_123007F
debug196:0123007A call    near ptr mscorwks_JIT_DbgIsJustMyCode
debug196:0123007F
debug196:0123007F loc_123007F:                            ; CODE XREF: debug196:01230078j
debug196:0123007F nop
debug196:01230080 call    near ptr unk_7B089128
debug196:01230085 nop
debug196:01230086 xor     ecx, ecx
debug196:01230088 call    near ptr unk_7B0891F8
debug196:0123008D nop
debug196:0123008E mov     ecx, offset unk_9C5C3C
debug196:01230093 call    near ptr mscorwks_JIT_NewCrossContext

然后使用 !ip2md eip就可以了

WINDBG>!ip2md eip
MethodDesc: 009c30b0
Method Name: XXXX.UI.Program.Main()
Class: 009c172c
MethodTable: 009c30b8
mdToken: 06000019
Module: 009c2c3c
IsJitted: yes
m_CodeOrIL: 01230070

ps:用IDA+windbg插件,要爽多了,不过有些命令使用不了
ps:这也只是一种方法~
雪    币: 4388
活跃值: (2784)
能力值: ( LV13,RANK:283 )
在线值:
发帖
回帖
粉丝
littlewisp 2 2011-5-31 17:25
3
0
“用IDA+windbg插件,要爽多了,不过有些命令使用不了“这个没有用过,回去实验一下,多谢分享
雪    币: 1137
活跃值: (10)
能力值: ( LV7,RANK:100 )
在线值:
发帖
回帖
粉丝
dreamzgj 2 2011-5-31 17:28
4
0
在windbg里面看反汇编代码还是不太习惯,而IDA在打开的时候,把.net程序作为普通的PE文件,而不要作为.netPE文件,后面调试的时候,符号都加载了,看起来非常清晰
游客
登录 | 注册 方可回帖
返回