本机代码调试 [英] Debugging of native code

查看:698
本文介绍了本机代码调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个呼吁,最初是写在VC6一个C DLL C#的服务。

I have a C# Service that is calling a C DLL that was originally written in VC6.

有是在我试图检查DLL的错误。

There is a bug in the DLL which I am trying to inspect.

有一个噩梦试图让调试工作,我最终加入该dll到包含C#服务VS2005的解决方案,并添加了必要的 _CRT_SECURE_NO_WARNINGS <后/ code>。

After having a nightmare trying to get debug to work I eventually added the dll to the VS2005 solution containing the C# Service and added the necessary _CRT_SECURE_NO_WARNINGS.

该服务的调试版本使用installutil.exe工具注册。

The debug version of the service is registered using 'installutil.exe' tool.

我可以调试流向何方通过调用被输入到 System.Diagnostics.Debugger.Break(该dll)前行,打破;

I can get the debugger to break just before the line where the dll is entered via a call to System.Diagnostics.Debugger.Break();.

我发现在网络上就步入调试非托管代码一些指示,并启用启用非托管代码调试复选框,我也试着打开的选项 - >调试 - >本地'加载DLL出口和启用RPC调试(即使它不是COM)。我也复制了调试DLL和.PDB到相同的bin目录中的服务。

I found some instruction on the net regarding stepping into debugging unmanaged code, and enabled the 'Enable unmanaged code debugging' check box, I've also tried turning on the Options->Debugging->Native 'Load DLL exports' and 'Enable RPC Debugging' (even though it's not COM). I've also copied the debug dll and .pdb to the same bin directory as the service.

不过非托管代码不被跨进这是我真正需要的

However the unmanaged code is not being stepped into which is what I really need.

更新:我发现调试类型在DLL中的属性并将其设置为混合按建议在几个网站,但没有。无济于事

UPDATE: I found the Debugging Type in the DLL properties and set it to 'Mixed' as per suggestion on several sites but to no avail.

UPDATE2 :我的项目现在发出调试DLL和PDB到同一目录作为调试服务。仍无法调试DLL。

UPDATE2: My project now emits the debug dll and the pdb to the same directory as the debug service. Still unable to debug the dll.

推荐答案

在最后,我创建了一个控制台应用程序,并重新创建所有的以前调用,以确保公正因为它与实际参数的实际服务所做的通话将采取行动,一旦到了那里。

In the end I created a console app and recreated all the prior calls just to make sure the call would act as it did in the actual service with the actual parameters once it got there.

我记载我的修补程序,并在我的网站

I chronicled my fix and the resultant code at my site.

这篇关于本机代码调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆