使用 Makefile 项目在 Visual Studio 中自定义调试命令
我在 Visual Studio 2010 中有一个由 Makefile 支持的项目(实际上使用 NAnt,但这不是重点)。
构建过程的输出是一个 .elf 文件,我有一个单独的非 VStudio 调试器,可以在该 .elf 文件上运行来调试它。
构建工作正常,但当我单击“调试”按钮(绿色小三角形)时,VStudio 失败并显示“无法启动程序“XXX.elf”。指定的文件是无法识别或不受支持的二进制格式”
我猜 VStudio 是只是试图像运行 .exe 一样“运行”.elf,但失败了。
我真正希望 VStudio 做的是在按下调试按钮时运行“my_debugger.exe XXX.elf”。
我尝试添加与 .elf=>my_debugger.exe 的文件关联 我也相应地更新了 PATHEXT,并在这些更改下运行 VStudio。 还是没有运气。
VStudio 中没有可以指定自定义调试命令的地方吗?我以为有,但是找不到。
我可以让构建过程输出一个 .bat 文件或我猜的其他文件,但这看起来很愚蠢。
I have a Makefile-powered project in Visual Studio 2010 (uses NAnt, in fact, but that's beside the point).
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.
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"
I'm guessing VStudio is just trying to 'run' the .elf as though it were an .exe, and failing.
What I really want VStudio to do is run "my_debugger.exe XXX.elf" when I press the debug button.
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.
Isn't there somewhere in VStudio where you can specify a custom debug command? I thought there was, but can't find it.
I could just have the build process output a .bat file or something I guess, but this seems silly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如吉姆提到的,您可以在项目设置(命令字段)中指定要启动运行的应用程序。如果您将调试器放置在那里,您可以将可执行文件作为参数传递给正在启动的调试器(命令参数字段)。通过这种方式,您可以启动调试器,如果调试器需要任何命令行参数,调试器将启动您的可执行文件。
Windows 上的 MinGW 示例:
命令:gdb.exe;命令参数:Path\ToMyApp\whatever.exe
将启动gdb.exe,gdb.exe将打开whatever.exe,解析调试信息并等待调试指令。
命令:msys.exe;命令参数:gdb.exe Path\ToMyApp\whatever.exe
将启动msys.exe,msys.exe将执行“gdb.exe Path\ToMyApp\whatever.exe”
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.
MinGW on Windows example:
Command: gdb.exe; Command Arguments: Path\ToMyApp\whatever.exe
will start gdb.exe, gdb.exe will open whatever.exe, parse the debug info and wait for debug instructions.
Command: msys.exe; Command Arguments: gdb.exe Path\ToMyApp\whatever.exe
will start msys.exe, msys.exe will execute "gdb.exe Path\ToMyApp\whatever.exe"
查看项目属性。您是否有一个“调试”选项卡,其中“开始操作”部分提供了三个选择?这些选择是:( ) 启动项目,(x) 启动外部程序:...( ) 使用 URL 启动浏览器。
您还可以设置命令行参数和工作目录。
比照。 如何:更改应用程序调试的启动操作
Look at the project properties. Do you have a Debug tab which has a Start Action section giving three choices? Those choices would be: ( ) Start project, (x) Start external program: ... ( ) Start browser with URL.
You can also set the command line arguments and working directory.
Cf. How to: Change the Start Action for Application Debugging