CLion在单独的系统终端中运行程序 [英] CLion run program in separate system terminal
问题描述
我有一个 ncurses
程序,我想使用CLion进行交互式调试。问题是当我在CLion中运行程序进行调试时,运行程序的内置控制台不会正确显示 ncurses
程序的输出。 p>
我想让程序在我的系统终端中运行,所以我可以在使用CLions调试器调试程序的同时看到输出。
有没有办法这样做?
完成此工作的最佳方法是使用GDB开始使用真的很令人沮丧不可以告诉你我如何在linux中完成它
- 打开一个终端并转到你的项目调试文件并输入
gdbserver localhost:1234 ./myFile
- 打开到myFile项目,在右上角你应该看到一个构建全部(或您的项目名称)单击它,然后转到左上角的编辑配置
- ,您应该看到一个加号,点击它,然后按GDB远程调试
- 然后在目标远程类型
tcp:127.0.0.1:1234
- 下一步在路径映射中按加号在远程和位置中键入
/ location / to / file / myFile
(与1.中相同的文件) - 按OK在右上角选择您刚刚创建的配置名称,然后按调试
您可能需要尝试重新启动gdbserver再一次这样工作,但如果您执行了上述所有步骤,您应该会看到一个调试提示,终端上应该会看到你的项目运行。
这是一些限制,例如,您始终必须在您的终端上运行 gdbserver localhost:1234 ./myFile
命令才能正常工作。
某些帮助我的视频/文档:
我希望这有助于:)
I have an ncurses
program that I'd like to interactively debug using CLion. The problem is that when I run the program in CLion to debug it, the inbuilt console where the program is run doesn't display the output of the ncurses
program properly.
I'd like to have the program run in my systems terminal so I can see the output properly whilst debugging the program with CLions debugger.
Is there any way to do this?
The best way to accomplish this is to use GDB now it can be really frustrating to get started so Ill show you how I accomplished it in linux
- open a terminal and go to your project debug file and type
gdbserver localhost:1234 ./myFile
- open clion to myFile project and in the upper right corner you should see a build all (or your projects name) click it and go to "edit configurations"
- in the upper left corner you should see a plus sign, click it and press "GDB remote debug"
- then in "target remote" type
tcp:127.0.0.1:1234
- Next in "path mappings" press the plus and type
/location/to/file/myFile
(same file as in 1.) in both Remote and Location - Press OK and in the upper right corner select the name of the configuration that you just made and press debug
you might need to try to restart the gdbserver one more time for this to work but if you did all the steps above you should see a debug prompt come up and on the terminal you should see your project running.
There are some limitations with this for example you always have to run gdbserver localhost:1234 ./myFile
command on your terminal for it to work.
Some Video/documentation that helped me:
I hope this helped :)
这篇关于CLion在单独的系统终端中运行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!