简体   繁体   中英

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. Is it possible to put a script or smth before IDEA opens the debugger?

I'm trying to achieve nearly the same thing and I succeed using bash except that the debugger has to be set up manually. I can use a script like this that pipes input to my executable from a bash script.

#!/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. I hope this helps?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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