简体   繁体   English

如何在/ bin / sh中设置gdb运行

[英]How to set gdb run in /bin/sh

Clion (c++ IDE) uses gdb as a debugger but it won't work unless we set /bin/sh as a SHELL. Clion(c ++ IDE)使用gdb作为调试器,但除非我们将/ bin / sh设置为SHELL,否则它将无法工作。 Is it possible to put a script or smth before IDEA opens the debugger? 在IDEA打开调试器之前是否可以放置脚本或smth?

I'm trying to achieve nearly the same thing and I succeed using bash except that the debugger has to be set up manually. 我试图实现几乎相同的事情,我成功使用bash除了必须手动设置调试器。 I can use a script like this that pipes input to my executable from a bash script. 我可以使用这样的脚本从bash脚本管道输入到我的可执行文件。

#!/bin/bash
echo "-- Testing our implementation of OpenShell --"
echo ""
echo "- If you have any problem in passing a test read the corresponding"
echo "- source file to understand what the test is checking"
echo ""
echo -n "********************* PRESS ENTER TO RUN TESTS  ... "
read answ
echo "top -b -n1|head -8|tail -1" | ./shell
echo -n "********************* PRESS ENTER TO TEST WILDCARDS  ... "
read answ
echo "ls -al *.*" | ./shell
echo ""
echo -n "********************* PRESS ENTER TO RUN CHECKENV  ... "
read answ
valgrind ./shell < <(echo "checkenv")
echo -n "********************* TEST ALGORITHMS ... "
read answ
valgrind ./shell < <(echo "ls -al open* |grep open|awk '{print \$9}'")
echo -n "********************* TEST DONE. YOU SHOULD SEE FILENAMES ABOVE ... "

I have saved the above code as RUN_TESTS and put is as my executable ( shell ) and then bash will execute the program according to the script. 我已将上面的代码保存为RUN_TESTS并将其作为我的可执行文件( shell ),然后bash将根据脚本执行程序。 I hope this helps? 我希望这有帮助?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM