Clion(c ++ IDE)使用gdb作为调试器,但除非我们将/ bin / sh设置为SHELL,否则它不会工作。在IDEA打开调试器之前是否可以放置脚本或smth?
答案 0 :(得分:0)
我尝试实现几乎相同的事情并且使用bash
成功,除了必须手动设置调试器。我可以使用这样的脚本从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 ... "
我已将上述代码保存为RUN_TESTS
,并将put作为我的可执行文件(shell
),然后bash
将根据脚本执行程序。我希望这有帮助吗?