您可以使用 Reflector 获取应用程序的源代码,然后使用该源代码进行调试吗?
似乎您可以使用 Relector 和调试器的混搭来调试任何 .NET 应用程序,而根本不需要源代码。 这可能吗? 有没有人见过这个?
It seems like you could use a mashup of Relector and a Debugger to be able to debug any .NET app WITHOUT having the source code at all. Is this possible? Has anyone seen this before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Reflector Pro 可以让您做到这一点!
Reflector Pro allows you to do exactly this!
我找不到链接,但有人确实使用反射器源来编译可以单步执行的 1.1 框架的调试版本。 我尝试使用 2.0 框架,发现太多错误,不值得我花时间。
如果您想尝试此操作,请从 FileDisassembler 之类的插件开始。 根据我的短暂经验,我发现有一些错误需要修复,但还不错。
对于中小型库,此方法应该非常可行。
I can't find the link but somebody did use the reflector source to compile a debug version of the 1.1 framework the could step through. I tried with the 2.0 framework and found too many errors to make it worth my while.
If you would like to try this start with a plugin like FileDisassembler. In my brief experience with this I found that there were some errors to fix but not to bad.
With a small-medium size library this method should be very doable.
我很久以前就尝试过这个但没有成功。 从那时起,Reflector 已经有了很大的改进,所以我想今天它可能是可能的。
如果你仔细想想,确实有点可怕。 有人可以反编译您的应用程序并获得完整的代码,然后修改它并分发他们自己的版本。 所有这些都无需开源。 但这又是“他们”创建混淆器的原因。
I tried this a long time ago without success. Reflector has improved alot since then so I imagine it may be possible today.
It's actually kind of scary if you think about it. Someone could decompile your app and have the full code, then modify it and distribute their own version of it. All without being open source. But then again that's why "they" created obfuscators.
Reflector 的 Deblector 插件允许您直接从 Reflector 进行调试。
The Deblector plug-in for Reflector allows you to debug straight from Reflector.
这是可能的,但在更复杂的应用程序中并不实用,特别是当使用了许多更新的结构(如 lambda 和初始化器)时(您会得到一大堆包含美元符号(如 CS$4$0000 )的变量名称,必须手动修复) 。 即使是简单的 switch 语句也会导致 Reflector 中出现一些非常丑陋的意大利面条式代码,其中充满了 goto 语句。
我在反编译为 MSIL 并在调试模式下重新编译方面运气更好。 然后,您可以在 IL 文件中放置断点并使用 VS 中的所有常用调试器功能。 MSIL 乍一看有点吓人,但你很快就能掌握它的窍门。
这篇优秀的文章解释了如何做到这一点:
http://www.codeproject.com/KB/dotnet/Debug_Framework_Classes.aspx
It's possible but not really practical in larger more complex applications, especially when lots of the more recent structures like lambdas and initializers have been used (you get a whole bunch of variable names containing dollar signs like CS$4$0000 that have to be fixed manually). Even simple switch statements can cause some very ugly spaghetti code full of goto statements in Reflector.
I've had a lot more luck decomiling to MSIL and recompiling in debug mode. You can then put break points in the IL files and use all the usual debugger features in VS. MSIL looks a little scary at first but you get the hang of it pretty quickly.
This excellent article explains how to do it:
http://www.codeproject.com/KB/dotnet/Debug_Framework_Classes.aspx
我以前见过并做过。 我用它来向我的老板表明我们的应用程序并不像他想象的那样受到保护。 拿了一个 DLL,得到了源代码,然后砰的一声——他差点心脏病发作了。
在某些情况下,.Net Reflector 会崩溃,但很难做到这一点——我知道,因为我已经积极尝试过。 好的混淆器会使代码变得难以管理/不可读(比如重载“a”函数以根据参数执行大量不同的操作),查看源代码对您没有好处,但您仍然可以调试 - 祝您好运知道发生了什么事。
I've seen it and done it before. I used it to show my boss that our app wasn't as protected as he thought it was. Took a DLL, got the source code, and bam -- he practically had a heart attack.
There are scenarios where .Net Reflector breaks down, but it is hard to do so -- I know because I've actively tried. The good obfuscators will make the code so unmanageable / unreadable (like overloading the "a" function to do a ton of different thigns based on the parameters) that seeing the source does you no good, but you can still debug -- good luck figuring out what is going on.
不,您需要属于您尝试调试的应用程序的符号文件 (.PDB) 文件。
Reflector 允许您从 IL 转换为可读的 .NET 代码,但它仅保留含义,而不是开发人员编写的确切代码。 因此,即使您有 PDB 和来自 Reflector 的源代码,它也无法匹配调试。
我想您可以使用反射器的源输出来创建 .NET 项目并生成您自己的要调试的程序集版本。 但这通常是一个真正的痛苦,对于 .NET 框架,微软会发布调试信息供任何感兴趣的人使用。
我记得曾经有一个用于在 Reflector 中进行调试的插件,但我永远无法让它工作。
配置 Visual Studio 以调试 .NET Framework 源代码
MSDN:PDB 文件
No, you need the symbol file (.PDB) file that belongs to the application you are trying to debug.
Reflector allows you to go from IL to readable .NET code but it maintains meaning only not the exact code as written by the developer. So even if you had the PDB and the source from Reflector it wouldn't match up for debugging.
I suppose you could use the source output from reflector to create a .NET project and generate your own version of the assembly you want to debug. That is ussually a real pain though and in the case of the .NET framework Microsoft publishes the debugging information for use by anyone who is interested.
I remember at one point there was a plugin for debugging in Reflector but I could never get it to work.
Configuring Visual Studio to Debug .NET Framework Source Code
MSDN: PDB Files