I need to debug a program that uses the crypt library, so I have to use -lcrypt, but the debugger automatically uses Make. How can I tell it to use Clang with arguments?
1 Answer
EDIT : Ahem. Actually that doesn't work. The IDE has a weird behaviour when I try to use my runner. Sorry :/
I've found the solution, here it is, for anyone that needs it.
First, know that you can't do the following in "less confortable" mode, which can be changed in the View
menu.
I've created my own runner, here's how to do it.
In the debugger window, the one on the bottom of the screen that opens when you hit Run
, you can see on the top-right Runner: C (GDB Debugging)
.
Click on it, and then at the bottom of the menu, click on New Runner
.
Then erase everything and put this :
// Create a custom Cloud9 runner - similar to the Sublime build system
// For more information see https://docs.c9.io/custom_runners.html
{
"cmd" : [
"sh",
"-c",
"clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wno-deprecated-declarations -Wshadow $file_name -lcs50 -lm -lcrypt -o $file_base_name && gdbserver --once :15470 $file_path/$file_base_name $args && echo '' || echo 'Please be sure to stop other debuggers before continuing.'"],
"info": "Compiling $file ...",
"debugport": 15470,
"debugger": "gdb",
"executable": "$file_path/$file_base_name",
"maxdepth": 50,
"env": {},
"selector": "^.*\\.c$"
}
Save, give it a name (the location is not to be changed), and select it in the previous menu.
If you ever had to edit it, then click, on the bottom of the menu, on Edit Runner
, while your runner is selected.
The line that is to be modified is the one starting with "clang -ggdb3 ...
. Don't change anything on this line that is after the &&
part.
You now can modify the clang arguments and still be able to debug with the graphical debugger.