[Geany-Users] Debugging with gdb

Colomban Wendling lists.ban at xxxxx
Tue Mar 1 21:28:45 UTC 2016


Le 24/02/2016 13:18, EenyMeenyMinyMoa a écrit :
> Hi,
> I want to do debugging by geany&gdb.
> I use debian jessie.
> At first, I post this question on debian-users mailing list.
> https://lists.debian.org/debian-user/2016/02/msg00696.html
> https://lists.debian.org/debian-user/2016/02/msg00697.html
> https://lists.debian.org/debian-user/2016/02/msg00810.html
> https://lists.debian.org/debian-user/2016/02/msg00815.html
> But I think this mailing list is more appropiate, so I post this.

Yes, here's probably a better location.

> In debian-users mailing list,
> I receive an advice
> that I should install geany-plugin-debugger, not geany-plugin-gdb,
> for debian jessie.

There are 3 debugger plugins:

geanygdb, which is quite old, Debugger and Scope.  I would recommend
either of the last 2, although I never tried Scope.

So that was good advice.

> After
> $ sudo apt-get install geany-plugin-debugger
> ,the Debug tab appeared at the below part of Geany.

That's good, at least the plugin is properly loaded now :)

> In the "Build"/"Set Build Commands" menu, I've set
> compile: gcc -Wall -g -c "%f"
> build: gcc -Wall -g -o "%e" "%f"
> I tried to do debugging the following code for a test.
> #include <stdio.h>
> int main() {
> double x = 3;
> printf("%d ", x);
> return 0;
> }

Good idea to debug this, it has a pretty glaring bug: %d format in
printf() expects an integer, not a double -- not to mention it's likely
missing a \n, too :)
Though, I'm not sure if a debugger can really help here…

> When I press the Run button in Debug tab,
> a message box appears saying
> "Error loading file".

Did you properly select the program to run in the Target entry of
Debugger's Target tab?  That's where you tell the plugin what program
you want to debug.  You need to select the binary GCC generated (and not
an object file, e.g. not something generated with GCC's -c option).

This said, the Debugger plugin received several fixes recently, which
will only be part of the next release.  In the previous version I think
it was not possible to work on files if their path contained non-ASCII
characters, i.e. accentuated letters from non-English languages.

> […]
> And in the "Breakpoints" tab, an old breakpoint of a past file still remains.
> How can I delete this?

You either click on the diamond shape in the sidebar when having this
file open, or select the breakpoint in the list and hit Delete.


More information about the Users mailing list