简体   繁体   English

VS2013下使用VS2010远程调试最佳实践

[英]Best practices remote debugging using VS2010 under VS2013

I'm looking for tips for those who to develop for Windows XP embedded in Visual Studio2013, then debug in Visual Studio 2010.我正在为那些针对嵌入在 Visual Studio2013 中的 Windows XP 进行开发,然后在 Visual Studio 2010 中进行调试的人寻找技巧。

The reasons for this are discussed in this Stack Overflow Link on the topic.其原因在有关该主题的堆栈溢出链接中进行了讨论。

Essentially the remote debug protocol changed after VS2010, and the new msvsmon.exe which uses the new VS2013 protocol doesn't support XP embedded debugging.基本上VS2010之后远程调试协议发生了变化,新的使用VS2013协议的msvsmon.exe不支持XP嵌入式调试。 So we are forced into a TWO IDE solution, one for builds, another for debug.所以我们被迫采用两种 IDE 解决方案,一种用于构建,另一种用于调试。 VS2013 is used for builds, and VS2010 is used to launch remote debug sessions. VS2013 用于构建,VS2010 用于启动远程调试会话。

There is some misinformation about the requirement to purchase both VS2013 and VS2010.关于同时购买 VS2013 和 VS2010 的要求存在一些错误信息。 It appears from the previously mentioned link, that it's possible to obtain the VS2010 debug environment for free.从前面提到的链接看来,可以免费获得 VS2010 调试环境。 I was able to verify the free download of the components, but haven't had time to validate that the debug environment works.我能够验证组件的免费下载,但没有时间验证调试环境是否有效。 The environment I use consists of a licensed copy of VS2013 and a licensed copy of VS2010.我使用的环境由 VS2013 的许可副本和 VS2010 的许可副本组成。

Here are two initial problems which I haven't seen doing remote debug in the former VS6 msvsmon.exe environment:这是我在以前的 VS6 msvsmon.exe 环境中进行远程调试时没有看到的两个初始问题:

1) With VS2013 build projects, VS2010 does not want to open the *.sln file. 1)VS2013编译项目,VS2010不想打开*.sln文件。 If I open the VS6 .dsp/.dsw we ported from VS2010 does a "ONE TIME CONVERSION" which destroys my painstakenly built VS2013 build project.如果我打开我们从 VS2010 移植的 VS6 .dsp/.dsw 会执行“一次性转换”,这会破坏我精心构建的 VS2013 构建项目。 It seems I will have to build TWO different solution spaces, one named SOLUTION_NAME_VS2013 and another SOLUTION_NAME_VS2010.看来我将不得不构建两个不同的解决方案空间,一个名为 SOLUTION_NAME_VS2013,另一个名为 SOLUTION_NAME_VS2010。 I'm interested to know if there is a more elegant solution to manage 1 set of BUILD files with two different "Highlander" (there can be only one) IDE's.我很想知道是否有更优雅的解决方案来管理具有两个不同“Highlander”(只能有一个)IDE 的一组 BUILD 文件。

2) When starting up the project remotely, if it crashes I get one of those annoying "Your program has crashed" dialogs on the Win2012 debug host (running VS2010), which is trapping the crash signal from the debugger. 2) 远程启动项目时,如果它崩溃,我会在 Win2012 调试主机(运行 VS2010)上收到令人讨厌的“您的程序已崩溃”对话框之一,它会捕获来自调试器的崩溃信号。 About 30% of the time, it detects the running instance of VS2010, 70% of the time it doesn't.大约 30% 的时间,它检测到正在运行的 VS2010 实例,70% 的时间它没有检测到。 崩溃对话框

3) msvmon times out (needs restarting) and requires extra time/mouse clicks to setup over the old vs6 msvcmon.exe 3) msvmon 超时(需要重新启动)并且需要额外的时间/鼠标点击来设置旧的 vs6 msvcmon.exe

I'm wondering if other Windows Embedded developers have discovered elegant solutions for these issues.我想知道其他 Windows Embedded 开发人员是否已经为这些问题找到了优雅的解决方案。 I'll post what I find here if I find any more tips moving forward.如果我发现更多的提示,我会在这里发布我找到的内容。


For Issue #1: Unable to read VS2013 *.sln file in VS2010 .对于问题 #1:无法在 VS2010 中读取 VS2013 *.sln 文件

The problem was that the VERSION of Visual Studio 2010 must be at least SERVICE PACK1.问题是 Visual Studio 2010 的版本必须至少是 SERVICE PACK1。 Earlier versions of Visual Studio 2010 cannot read the VS2012/VS2013/VS2015 solution files.早期版本的 Visual Studio 2010 无法读取 VS2012/VS2013/VS2015 解决方案文件。

工作与非工作 VS2010 的屏幕截图

For Issue #2: Your program has crashed dialog preventing signals from reaching debugger .对于问题 #2:您的程序已崩溃的对话框阻止信号到达 debugger

This Stack Overflow link was helpful.这个堆栈溢出链接很有帮助。 There are multiple ways to suppress the "Your program has crashed" dialog.有多种方法可以抑制“您的程序已崩溃”对话框。 In my case, users may need to debug new applications on a production system, so changing the setting globally is not ideal.就我而言,用户可能需要在生产系统上调试新应用程序,因此全局更改设置并不理想。

I choose the solution from this Raymond Chen link it allows me to disable the dialog box on an application by application basis.我从这个 Raymond Chen 链接中选择了解决方案,它允许我逐个应用程序禁用对话框。 Since I typically have access to source code I'm debugging this was the best solution for me.由于我通常可以访问源代码,因此我正在调试这对我来说是最好的解决方案。

DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX);

I still see an issue occasionally with the Windows runtime not seeing the running debugger instance on a crash and wanting to initiate a new one.我仍然偶尔会看到一个问题,Windows 运行时在崩溃时没有看到正在运行的调试器实例,而是想启动一个新的调试器实例。 This seems to happen ~30% of the time.这似乎发生在大约 30% 的时间。 When I figure out what is causing that I will update it here.当我弄清楚是什么原因导致我会在这里更新它。

Finally, the new remote debug client changed to msvmon.exe which has improved security.最后,新的远程调试客户端更改为msvmon.exe ,提高了安全性。 To save the extra mouse clicks, the following command is usefull to run on the remote Windows Embedded XP client:为了节省额外的鼠标点击,在远程 Windows Embedded XP 客户端上运行以下命令很有用:

"Path\to\msvsmon.exe" /anyuser /noauth /nosecuritywarn /timeout:2147483646

The /noauth and /anyuser require /nosecuritywarn . /noauth/anyuser需要/nosecuritywarn /timeout max value keeps the debugger client from terminating after ~ hour of idle time. /timeout最大值可防止调试器客户端在空闲时间 ~ 小时后终止。 If your workday is to be spent debugging you don't want it timing out after a coffee/rebuild all break.如果您的工作日用于调试,您不希望它在喝完咖啡/重建全部中断后超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM