`
happmaoo
  • 浏览: 4347518 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

如何调试托管代码(managed code)和非托管代码(native code)混合的项目

阅读更多
<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/46860.html" frameborder="0" width="468" scrolling="no" height="60"></iframe>

在调试同时存在托管代码和非托管代码的程序的时候,需要特别注意选用适当的调试器的类型。因为看到类似的问题问得比较多,因此这里把做法写出来。

在托管项目中在调试之前,需要打开对非托管代码调试的功能,这个选项在项目的属性的Debug选项中存在:

<!--[if gte vml 1]><v:shapetype id="_x0000_t75"coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"filled="f" stroked="f"><v:stroke joinstyle="miter" /><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0" /><v:f eqn="sum @0 1 0" /><v:f eqn="sum 0 0 @1" /><v:f eqn="prod @2 1 2" /><v:f eqn="prod @3 21600 pixelWidth" /><v:f eqn="prod @3 21600 pixelHeight" /><v:f eqn="sum @0 0 1" /><v:f eqn="prod @6 1 2" /><v:f eqn="prod @7 21600 pixelWidth" /><v:f eqn="sum @8 21600 0" /><v:f eqn="prod @7 21600 pixelHeight" /><v:f eqn="sum @10 21600 0" /></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" /><o:lock v:ext="edit" aspectratio="t" /></v:shapetype><v:shape id="Picture_x0020_10" o:spid="_x0000_i1027" type="#_x0000_t75"style='width:406.5pt;height:261pt;visibility:visible;mso-wrap-style:square'><v:imagedata src="file:///C:\Users\ATField\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"o:title="" /></v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

打上钩即可。

如果是在Attach到一个进程的时候,需要在Attach to Process这个对话框中选择进程的类型:

<!--[if gte vml 1]><v:shape id="Picture_x0020_11"o:spid="_x0000_i1026" type="#_x0000_t75" style='width:617.25pt;height:165pt;visibility:visible;mso-wrap-style:square'><v:imagedata src="file:///C:\Users\ATField\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png"o:title="" /></v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

缺省是自动选择,不过这个并不是总是正确,最好自己选择正确的类型。点击Select弹出Select Code Type对话框:

<!--[if gte vml 1]><v:shape id="Picture_x0020_7"o:spid="_x0000_i1025" type="#_x0000_t75" style='width:355.5pt;height:186.75pt;visibility:visible;mso-wrap-style:square'><v:imagedata src="file:///C:\Users\ATField\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png"o:title="" /></v:shape><![endif]--><!--[if !vml]--><!--[endif]-->

比如,如果是调试托管和非托管混合的代码,则把ManagedNative都勾上即可

作者: 张羿(ATField)
Blog:
http://blog.csdn.net/atfield
http://blogs.msdn.com/yizhang
转载请注明出处



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1860373


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics