how to use the geany debugger?

Solution 1:

I have come across this problem myself.

  • Compiler: gcc
  • Debugger: gdb
  • Editor: geany

Assuming you have installed gcc and gdb by this.

Install gcc and gdb

sudo apt install gcc gdb

To install geany:

sudo apt install geany

To install the plugins for geany:

sudo apt install geany-plugins

Restart geany if open now.

To activate the debugger in geany: menu->tools->plugin manager , checkbox the debugger.

Change the build commands to include the -g flag:

menu->build->build commands

Set the compile command to:

gcc -g -Wall -c "%f"

Set the build command to:

gcc -g -Wall -o "%e" "%f"

And now you can set breakpoints in your code by clicking next to the line numbers. You will see a red square.

In the menu->view->show message window You will have a tab called debug.

Click the debug tab then click the target tab.

Choose your target(if you build "example.c" and set output to "example" which you would normally run with "./example" you would choose "example" as target.

On the right side of that window you can start the debugging.