User avatar
StevenP
Posts: 57
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK

Geany IDE C Code Debugger

Fri Jan 25, 2013 7:35 am

Hi. I would like to do line by line debugging of my C code program in the Geany IDE.
Is this possible with the Pi? I have read about a PC/Linux plugin GeanyGDB which sounds suitable. Is this also available for the Pi?

Does anyone have any experience of this on the Pi? (I would really prefer not to do cross-development using a PC and Eclipse).
Cheers.
"The time has come," the Walrus said,
"To talk of many things..."

rgh
Posts: 212
Joined: Fri Nov 25, 2011 3:53 pm

Re: Geany IDE C Code Debugger

Fri Jan 25, 2013 4:49 pm

Never used it, but it appears to be available:

Code: Select all

richard@raspberrypi ~/servod $ apt-cache search geany
geany - fast and lightweight IDE
geany-common - fast and lightweight IDE -- common files
geany-plugin-addons - miscellanous plugins for Geany
geany-plugin-codenav - code navigation plugin for Geany
geany-plugin-debugger - debugger plugin for Geany
geany-plugin-doc - documentation plugin for Geany
geany-plugin-extrasel - extra selection plugin for Geany
geany-plugin-gdb - GDB plugin for Geany <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
geany-plugin-gendoc - documentation generation plugin for Geany
geany-plugin-gproject - gproject plugin for Geany
geany-plugin-insertnum - number inserting plugin for Geany
...
So, try "sudo apt-get install geany-plugin-gdb".

henryd
Posts: 5
Joined: Thu Dec 22, 2011 2:30 pm

Re: Geany IDE C Code Debugger

Mon Jan 28, 2013 7:09 pm

I just did this by 'sudo apt-get install geany-plugins' that installs geanydebugger, along with lots of other plugins.
While Debugger appears and is Checked in the Tools/Plugin Manager menu, I never actually get to see the Debugger toolbar. Neither can I set breakpoints, single step etc.
Haven't figured out whats wrong yet but I'll report back here when I get it to work.

User avatar
StevenP
Posts: 57
Joined: Tue Aug 14, 2012 7:55 pm
Location: Germany / UK

Re: Geany IDE C Code Debugger

Tue Jan 29, 2013 1:52 pm

Thanks all for the tips!
I have had quite good success using:

Code: Select all

 sudo apt-get install geany-plugins
Then in Geany select :
Tools/Plugin Manager/Geany GDB (NOT Debugger!)

Also the compiler switch '-g' needs to be present to produce the debug version of the executable. I did this in the project's makefile:
CFLAGS=-g

Which seemed to work OK, but maybe it could also be done in:
Build/set build commands/Build/C commands ?

I then got a new panel and drop-down menu for debugging.

To overcome the terminal error message: in the debug panel, 'Options', I set Terminal to lxterminal. Alternatively you uncheck the 'run in terminal' box.

In the debug panel, I clicked 'Load', selected my executable.
In the editor I selected a line in my .c file and clicked 'Break' to set set a breakpoint there.
You can also select a variable in the editor, then click 'Watches' to watch that variable for changes.

That's my experience so far with Geany GDB. It's not rock solid - I had to kill and restart Geany several times - but it is a very useful tool for debugging when you are stuck.
Any further tips welcome!
"The time has come," the Walrus said,
"To talk of many things..."

jmachm
Posts: 2
Joined: Mon Feb 18, 2013 1:36 pm

Re: Geany IDE C Code Debugger

Fri Aug 16, 2013 9:25 am

Thaks for the comments. I have installed geany-plugins and enebled the geany GDB. in the build command: Build/set build commands you need to add '-g' option, so the appliction with have debug information. After that, load the aplication from the "Debug" menu.

chris77
Posts: 1
Joined: Thu Apr 02, 2015 6:18 am

Re: Geany IDE C Code Debugger

Sat Apr 04, 2015 4:30 am

How do you select a line in the geany editor ?

m.daae
Posts: 22
Joined: Thu Apr 02, 2015 4:59 pm

Re: Geany IDE C Code Debugger

Mon Apr 06, 2015 10:57 pm

chris77 wrote:How do you select a line in the geany editor ?
Do you mean for editing or debug?
Edit : <Alt><Shift>l
Debug : (after load) Debug pull-down, select Break and input line number ...

SinewaveMan
Posts: 12
Joined: Sun Jul 19, 2015 5:17 am

Re: Geany IDE C Code Debugger

Fri Aug 07, 2015 6:22 pm

StevenP wrote: . . . . . . I have had quite good success using:

Code: Select all

 sudo apt-get install geany-plugins
Then in Geany select :
Tools/Plugin Manager/Geany GDB (NOT Debugger!)

Also the compiler switch '-g' needs to be present to produce the debug version of the executable. I did this in the project's makefile:
CFLAGS=-g

Which seemed to work OK, but maybe it could also be done in:
Build/set build commands/Build/C commands ?

I then got a new panel and drop-down menu for debugging.

. . . . . . . in the debug panel, 'Options', I set Terminal to lxterminal.

In the debug panel, I clicked 'Load', selected my executable.
So I did: sudo apt-get install geany-plugins - took a long time but no problems.
Then: Tools/Plugin Manager/Geany GDB - no problem.
At the suggestion: Also the compiler switch '-g' needs to be present - don't know where to do this????
Then: in the debug panel, 'Options', I set Terminal to lxterminal - OK, no problem.
Then: In the debug panel, I clicked 'Load', selected my executable (tkphone.py) - problem:
Error: Target file must be ELF 32-bit x86 executable

More information:
I have just learned to spell python in the last few days, so consider myself a newbie - please assist.
I have edited some things in tkphone.py and it runs ok in interpreter mode with geany and idle.
Debug mode in idle runs ok, but I do not understand how to get the geany debugger to work.
I have tried both idle and geany in an attempt to decide which ide, and debugger, is best suited to my needs.
(My needs are minimal: a background in many languages and now programming as a hobby: quick results!)
Idle suits me, but the lack of line numbers in the editor is a big disadvantage.
Geany editor appears to be better and, of course, there are the line numbers.
So, my immediate questions are:
1) which editor and debugger are considered suitable for a hobbyist (student at junior school too)?
2) if geany is really more suitable, how do we get the debugger to work?

Any additional information, or pointers/links to more information are very welcome.

Return to “C/C++”