使用Makefile项目的Visual Studio中的自定义调试命令 [英] Custom debug command in Visual Studio using a Makefile project

查看:145
本文介绍了使用Makefile项目的Visual Studio中的自定义调试命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2010中有一个基于Makefile的项目(实际上使用NAnt,但这不重要).

I have a Makefile-powered project in Visual Studio 2010 (uses NAnt, in fact, but that's beside the point).

构建过程的输出是一个.elf文件,我有一个单独的非VStudio调试器,可以在该.elf文件上运行该调试器来进行调试.

The output of the build process is a .elf file, and I have a separate, non-VStudio debugger which can be run on that .elf file to debug it.

构建正常,但是当我单击调试"按钮(绿色小三角形)时,VStudio失败,显示无法启动程序'XXX.elf'.指定的文件是无法识别或不受支持的二进制格式"

Building works fine, but when I click the 'debug' button (little green triangle), VStudio fails with "Unable to start program 'XXX.elf'. The specified file is an unrecognized or unsupported binary format"

我猜VStudio只是试图像运行.exe一样运行" .elf,并且失败了.

I'm guessing VStudio is just trying to 'run' the .elf as though it were an .exe, and failing.

我真的希望VStudio进行的操作是,当我按下调试按钮时运行"my_debugger.exe XXX.elf".

What I really want VStudio to do is run "my_debugger.exe XXX.elf" when I press the debug button.

我尝试使用.elf => my_debugger.exe添加文件关联 我也适当地更新了PATHEXT,并在这些更改下运行了VStudio. 还是没有运气.

I have tried adding a file association with .elf=>my_debugger.exe I have updated PATHEXT appropriately as well, and run VStudio under those changes. Still no luck.

在VStudio中是否可以指定自定义调试命令的地方?我以为有,但是找不到.

Isn't there somewhere in VStudio where you can specify a custom debug command? I thought there was, but can't find it.

我可以让构建过程输出一个.bat文件或我猜的东西,但这似乎很愚蠢.

I could just have the build process output a .bat file or something I guess, but this seems silly.

推荐答案

如Jim所述,您可以在项目设置(命令"字段)中指定要启动运行的应用程序.如果在此处放置调试器,则可以将可执行文件作为参数传递给正在启动的调试器(命令参数"字段).这样,您可以启动调试器,如果调试器需要任何命令行参数,则调试器又将启动可执行文件.

As Jim mentioned you can specify which app to start on run in the project settings (Command field). If you place a debugger there you can pass down your executable as an argument to the debugger being launched (Command Arguments field). This way you can launch the debugger which in turn will launch your executable if the debugger expects any commandline arguments.

Windows上的MinGW示例:

MinGW on Windows example:

  1. 命令: gdb.exe ;命令参数: Path \ ToMyApp \ whatever.exe

将启动gdb.exe,gdb.exe将打开what.exe,解析调试信息并等待调试指令.

will start gdb.exe, gdb.exe will open whatever.exe, parse the debug info and wait for debug instructions.

命令: msys.exe ;命令参数: gdb.exe路径\ ToMyApp \ whatever.exe

将启动msys.exe,msys.exe将执行"gdb.exe Path \ ToMyApp \ whatever.exe"

will start msys.exe, msys.exe will execute "gdb.exe Path\ToMyApp\whatever.exe"

这篇关于使用Makefile项目的Visual Studio中的自定义调试命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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