vs.net2005下进行remote debugging

msdn里面对如何进行远程调试讲的很清楚,对于vc调试图形界面的程序就很方便
远程机,也就是被调试机
本地机,运行vs.net的调试机
步骤:
1、把本地机的 Install path /Microsoft Visual Studio 8/Common7/IDE/Remote Debugger/x86目录拷贝到远程机,该目录下有远程机运行需要的msvcmon.exe以及所需要的动态库
2、配置windows防火墙,需要配置一堆东西,两台机器都需要配置,所以最简单的方法就是先关掉,不嫌麻烦的话就按照最后面那一堆英文配置吧,我配置过
3、两台机器都设置本地安全策略,步骤 控制面板-》管理工具-》本地安全策略,打开对话框后在安全设置-》本地策略-》安全选项-》网络访问:本地账户的共享和安全模式 更改为经典-本地用户以自己的身份验证
4、把本地机的需要调试的程序拷贝到远程机,例如拷贝到d:/debug/test.exe
5、远程机启动msvcmon.exe等待即可
6、本地打开需要调试的工程,并作如下设置
打开 项目-》属性-》配置属性-》调试,要启动的调试器改为远程widows调试器
远程命令:改为远程机器上的待调试程序的目录d:/debug/test.exe
工作目录:msdn上写的是本地的工程目录,我设置几次总是不对,设置为空就可以了
远程服务器名称:远程机的名字或者ip
连接:带windows身份验证的远程访问
调试器类型:仅限本机
7、设置symbol路径,工具-》选项-》调试-》符号,符号文件位置设置上第三方库的pdb或者dbg文件的位置,如果没有调用其他的库,不设置应该也可以
8、调试即可
 
 
 
附:配置windows防火墙
 

To configure the Visual Studio host computer

  1. In Control Panel,click Security Center.

  2. In the Windows Security Center, click Windows Firewall.

  3. In the Internet Connection Firewall window, click the Exceptions tab.

  4. Steps 6-9 open TCP port 135 (used by DCOM to communicate with remote computers).

  5. On the Exceptions tab, click the Add a Port button.

  6. In the Add Port dialog box, do the following:

    • For Port Number, type 135.

    • For Description, type a description (such as remote debugging DCOM).

    • Select TCP.

  7. (Optional) Limiting access to computers on your local subnet enhances security. You should do this unless you have to debug outside the local subnet.

    1. Click Change Scope.

    2. In the Change Scope dialog box, select My network (subnet) only.

    3. Click OK.

       

  8. Click OK to close the Add a Port dialog box.

  9. If your domain policy requires network communication to be done through IPSec, do this step. Otherwise, skip it.

    • Open UDP port 4500 (used for IP security) by repeating the prior step, substituting UDP for the Protocol, and 4500 for the Port Number.

    • Open UDP port 500 (used for IP security) the same way, substituting UDP for the Protocol, and 500 for the Port Number.

       

    Steps 11-16 add Devenv.exe (the Microsoft Visual Studio development environment) to the SP2 application security Exception list so that it can dynamically open ports at runtime.

  10. Click Add a program.

  11. In the Add program dialog box, click the Browse button.

  12. In the Browse dialog box, navigate to where devenv.exe is located (typically SystemDrive:/Program Files/Microsoft Visual Studio 8 Common7/IDE). Select devenv.exe.

  13. Click OK to close the Browse dialog box.

  14. (Optional) Limiting access to computers on your local subnet enhances security. You should do this unless you have to debug outside the local subnet.

    1. Click Change Scope.

    2. In the Change Scope dialog box, select My network (subnet) only.

    3. Click OK.

       

       

  15. Click OK to close the Add a program dialog box.

     

     

     

     

     

     

To configure the remote computer

  1. In Control Panel,click Security Center.

  2. In the Windows Security Center, click Windows Firewall.

  3. In the Internet Connection Firewall window, click the Exceptions tab.

    Steps 5-8 open the TCP 135 port, which is used by DCOM to communicate with remote computers.

  4. On the Exceptions tab, click the Add Port button

  5. In the Add Port dialog box, do the following:

    • For Port Number, type 135.

    • For Description, type a description (such as remote debugging DCOM).

    • Select TCP.

       

       

  6. (Optional) Limiting access to computers on your local subnet enhances security. You should do this unless you have to debug outside the local subnet.

    1. Click Change Scope.

    2. In the Change Scope dialog box, select My network (subnet) only.

    3. Click OK.

       

       

  7. Click OK to close the Add Port dialog box.

  8. If your domain policy requires network communication to be done through IPSec, do this step. Otherwise, skip it.

    • Open UDP port 4500 (used for IP security) by repeating the prior step, substituting UDP for the Protocol, and 4500 for the Port Number.

    • Open UDP port 500 (used for IP security) the same way, substituting UDP for the Protocol, and 500 for the Port Number.

       

    Steps 10-14 open ports necessary for file and print sharing.

  9. In the Programs and Services box, select File and Print Sharing.

  10. Click the Edit button.

  11. In the Edit a Service dialog box, select the following ports: TCP 139, TCP 445, UDP 137, and UDP 138.

  12. (Optional) Limiting access to computers on your local subnet enhances security. You should do this unless you have to debug outside the local subnet.

    1. Click Change Scope.

    2. In the Change Scope dialog box, select My network (subnet) only.

    3. Click OK.

       

  13. Click OK to close the Edit a Service dialog box.

    Steps 15-19 add msvsmon to the SP2 Exception list. This enables it to dynamically open ports at run time.

  14. Click the Add a Program button.

  15. In the Add a Program dialog box, click the Browse button.

  16. In the Browse dialog box, navigate to where Msvsmon.exe is located, which will be one of the following directories:

    Install path /Microsoft Visual Studio 8/Common7/IDE/Remote Debugger/x86

    Install path /Microsoft Visual Studio 8/Common7/IDE/Remote Debugger/x64

    Install path /Microsoft Visual Studio 8/Common7/IDE/Remote Debugger/ia64

  17. (Optional) Limiting access to computers on your local subnet enhances security. You should do this unless you have to debug outside the local subnet.

    1. Click Change Scope.

    2. In the Change Scope dialog box, select My network (subnet) only.

    3. Click OK.

  18. Click OK to close the Add a program dialog box.

  19. Click OK to close Windows Firewall.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
(1) 远程端:安装VS2005光盘"\vs\Remote Debugger\x86\rdbgsetup.exe"。或者直接运行或copy本地端的: "Program Files\Microsoft Visual Studio 8\Common7\IDE\Remote Debugger\x86" (2) 远程端:“本地安全策略 - 安全选项 - 网络访问:本地帐户的共享和安全模式”改为:经典-本地用户以自己的身份验证。 (3) 远程端:启动Remote Debuger,从“工具 - 选项”中将身份验证模式改为“无身份验证,允许任何用户进行调试”。 或者直接用命令行:"\ msvsmon.exe" /noauth /anyuser /nosecuritywarn,可以建个快捷方式以方便运行。 (4) 将需要调试的程序debug版本和相应的pdb文件(包含调试信息)拷贝到远程主机,启动该debug版本程序。 (5) 本地:在VS2005中,“工具”--“附加到进程”,传输选“远程”,限定符输入远程端的主机名或IP地址,回车,选择我们需要调试的应用程序。如果一切正常,那么我们现在可以像调试本机程序一样调试远程主机上运行的debug版本了。 细节和常见问题: (1)如果是64位系统,请选择x64,即\vs\Remote Debugger\x64\rdbgsetup.exe; (2)不要因为远程主机是64位的,就使用64位的remote debugger,它必须和你的应用程序匹配,即统一为32位,或64位。 (3)如果是家庭版,控制面板管理工具里是没有“本地安装策略”这个工具的,那么只能通过修改注册表来实现,注册表项:[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa], 找到“forceguest”,如果它的值为1,即dword:00000001,表示“仅来宾 - 对本地用户进行身份验证,其身份为来宾”(这个描述win7和之前的系统稍有不同),如果值为0,即dword:00000000,表示“经典 - 对本地用户进行身份验证,不改变其本来身份”。我们需要的值为0。 (4)win7/vista下远程连接到目标主机,已经成功显示了进程列表,但是attach待调试程序时候本地出现提示“Unable to attach the process - 系统找不到指定的文件 ”,这是因为remote debugger权限不足导致,以管理员权限重新启动remote debugger解决该问题。 (5)成功attach到远程主机目标程序,但是本地无法下断点,或者断点下了之后处于不可被触发状态。解决办法:rebuild整个工程,然后将重新编译的程序和pdb文件覆盖远程主机相应文件(这个和本地调试完全一样是不:P)。 (6)debug版本的程序拷到远程主机之后,无法运行,那好因为缺少相应的debug版本动态库和相关版本配置文件(可以用VS附带工具Depends查看)。以MFC程序为例,需要如下操作: 1)将VS目录下Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86下的三个目录相应的动态库拷贝到远程主机应用程序根目录下或者c:\windows\system32\目录下。 2)在c:\windows\winsxs\目录下找到编译主机vs2005版本匹配的目录:Microsoft.VC80.DebugCRT、Microsoft.VC80.DebugMFC,将他们拷贝到目标主机c:\windows\winsxs目录下。在将本地winsxs\Manifests\目录下的几个相应文件拷贝到目标主机这个目录下。最后将本机winsxs\Policies\目录下的相应子文件拷贝到相同目录下。这个链接说的更加的详细:http://wenwen.soso.com/z/q165079372.htm 注意:win7/vsita下winsxs是没有权限往里面写东西的,所以要更改权限,这个可以网上搜索,我就不详述了。 现在已经可以正常运行debug版本的程序了,即便该主机没有开发环境:)。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值