[英]C# and MASM dll library how to debug?
I have a bit of a problem with my project, that being said - I cannot debug the dll (written in MASM) loaded to a program written in C#. 我的项目有一个问题,就是说-我无法调试加载到用C#编写的程序中的dll(以MASM编写)。 I do leave breakpoints in various places of the procedure in dll but nothing happens.
我的确在dll的过程中的各个位置都留下了断点,但是什么也没有发生。 Program execution just goes through the procedure without stopping.
程序执行只是通过该过程而不会停止。
I use Visual Studio 2010 and have the following structure of the solution: 我使用Visual Studio 2010,并具有以下解决方案的结构:
Solution
|
+--+ the masm dll project
| |
| +- *.asm
| |
| +- *.def
|
+--+ C# dll library poject
|
+--+ my C# project
Therefore I have access to the source code of the dll, and its project is within the same solution as invoking project. 因此,我可以访问dll的源代码,并且它的项目与调用项目在同一解决方案内。
However when I set the breakpoint within the C# library project it works. 但是,当我在C#库项目中设置断点时,它可以工作。
And still I cannot debug this bugger. 而且我仍然无法调试这个错误。 Can anyone point me towards the solution of the problem?
谁能指出我要解决的问题?
All you have to do in order to be able to debug unmanaged dll ( not only masm, nasm, etc. ) is to enable unamanged code debugging, that is done (in VS2010) by: 为了能够调试非托管dll(不仅是masm,nasm等),您需要做的就是启用未管理的代码调试,该操作通过以下方式完成(在VS2010中):
To enable debugging of unmanaged code 启用非托管代码的调试
- With a project selected in Solution Explorer, on the Project menu, click Properties.
在解决方案资源管理器中选择一个项目后,在“项目”菜单上,单击“属性”。
- Click the Debug tab.
单击调试选项卡。
- Select the Enable unmanaged code debugging check box.
选择启用非托管代码调试复选框。
You need to enable unmanaged code debugging in your c# project's Debug setting. 您需要在c#项目的“调试”设置中启用非托管代码调试。 If that still doesn't work, since you have the asm code, you can insert
int 3
in your asm as a hardcoded break instruction, and rebuild your dll. 如果仍然不能解决问题,因为您拥有asm代码,则可以在asm中插入
int 3
作为硬编码的中断指令,然后重新生成dll。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.