码迷,mamicode.com
首页 > 系统相关 > 详细

Vs2013在Linux开发中的应用(16): 修改调试器参数

时间:2014-12-07 17:49:56      阅读:317      评论:0      收藏:0      [点我收藏+]

标签:linux   msbuild   vs2012   

快乐虾

http://blog.csdn.net/lights_joy/

欢迎转载,但请保留作者信息


仿照debugger_local_windows.xml的写法,修改名称和ID


<?xml version="1.0"encoding="utf-8"?>


<!--Copyright, Microsoft Corporation, All rights reserved.-->


<Rule Name="9F2571B6-5567-43D2-8510-BFB85D559120" DisplayName="远程 gdb 调试器"PageTemplate="debugger" Description="远程 gdb 调试器选项 ssh" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/build/2009/properties">


 


  <Rule.DataSource>


    <DataSource Persistence="UserFile"/>


  </Rule.DataSource>


 


  <StringProperty Name="LocalDebuggerCommand" DisplayName="命令" Description="要执行的调试命令。" F1Keyword="VC.Project.IVCLocalDebugPageObject.Command">


    <StringProperty.ValueEditors>


      <ValueEditor EditorType="DefaultFindFullPathPropertyEditor" DisplayName="&lt;regsvr32.exe&gt;">


        <ValueEditor.Metadata>


          <NameValuePair Name="Exename"Value="regsvr32.exe"/>


        </ValueEditor.Metadata>


      </ValueEditor>


      <ValueEditor EditorType="DefaultStringPropertyEditor" DisplayName="&lt;编辑...&gt;"/>


      <ValueEditor EditorType="DefaultFilePropertyEditor" DisplayName="&lt;浏览...&gt;"/>


    </StringProperty.ValueEditors>


  </StringProperty>


 


  </EnumProperty>


</Rule>


IDE界面上可以看到我们自定义的调试器:

bubuko.com,布布扣


但此时按F5VS并不会调用我们的调试器:

bubuko.com,布布扣


查下MSDN关于启动调试有这样一段话:


Programmatically, when the userfirst presses F5, Visual Studio‘s debug package calls the project package(which is associated with the type of program being launched) through theDebugLaunch method, which in turn fills out a VsDebugTargetInfo2 structure with the solution‘s active project debugsettings. This structure is passed back to the debug package through a call tothe LaunchDebugTargets2 method. The debug package then instantiates the sessiondebug manager (SDM), which launches the program being debugged and any associateddebug engines.


 


One of the arguments passed tothe SDM is the GUID of the DE to be used to launch the program.


 


If the DE GUID is not GUID_NULL,the SDM co-creates the DE, and then calls itsIDebugEngineLaunch2::LaunchSuspended method to launch the program. For example,if a program is written in native code, thenIDebugEngineLaunch2::LaunchSuspended will probably call CreateProcess andResumeThread (Win32 functions) to run the program.


也就是说,IDE会先调用VC Package中的IVsDebuggableProjectCfg.DebugLaunch 方法,在VC实现的这个方法中填充VsDebugTargetInfo2结构体,然后初始化SDM。而VC的填充过程是我们无法干预的,即使我们添加了自己的调试器参数,VC似乎也使用不上。


观察MSBUILD目录下的文件,发现有个地方出现了一个调试器的GUID


    <LocalGPUDebuggerTargetType Condition="‘$(GPUDebuggerTargetType)‘== ‘‘">{F4453496-1DB8-47F8-A7D5-31EBDDC2EC96}</LocalGPUDebuggerTargetType>


    <RemoteGPUDebuggerTargetType Condition="‘$(GPUDebuggerTargetType)‘== ‘‘">{F4453496-1DB8-47F8-A7D5-31EBDDC2EC96}</RemoteGPUDebuggerTargetType>


这里的{F4453496-1DB8-47F8-A7D5-31EBDDC2EC96}就是预先注册的一个调试器:

bubuko.com,布布扣


我们将这里的GUID替换为自己的调试器的GUID


  <PropertyGroup>


    <DebuggerType>GpuOnly</DebuggerType>


    <LocalGPUDebuggerTargetType Condition="‘$(GPUDebuggerTargetType)‘== ‘‘">{9F2571B6-5567-43D2-8510-BFB85D559120}</LocalGPUDebuggerTargetType>


    <RemoteGPUDebuggerTargetType Condition="‘$(GPUDebuggerTargetType)‘== ‘‘">{9F2571B6-5567-43D2-8510-BFB85D559120}</RemoteGPUDebuggerTargetType>


  </PropertyGroup>


再将调试启动选项配置为:

bubuko.com,布布扣


再按F5启动调试,果然VS正确调用了我们的调试器!!!







Vs2013在Linux开发中的应用(16): 修改调试器参数

标签:linux   msbuild   vs2012   

原文地址:http://blog.csdn.net/lights_joy/article/details/41788487

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!