Lately I've switched from Visual Studio in Windows 7 to Ubuntu with Netbeans 8.0 (C++). From that time I have big problem with debugging my application from NetBeans (gdb works perfectly fine). I have written hello world c++ with gradle to demonstrate my problem. I've spent a lot of time but without any significant progress.
build.gradle:
apply plugin: 'cpp'
executables {
helloWorld
}
binaries.all {
cppCompiler.args "-g"
}
main.cpp:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int a = 10;
int b = 12;
int c = a + b;
puts("Hello World!!!");
return EXIT_SUCCESS;
}
Then i build and run gdb:
robert-Aspire-S3:~/NetBeansProjects/helloWorld$ gradle helloWorldExecutable
robert-Aspire-S3:~/NetBeansProjects/helloWorld$ gdb ./build/binaries/helloWorldExecutable/helloWorld
....
Reading symbols from ./build/binaries/helloWorldExecutable/helloWorld...done.
(gdb) b 5
Breakpoint 1, main () at /home/robert/NetBeansProjects/helloWorld/src/helloWorld/cpp/main.cpp:5
5 int a = 10;
(gdb) n
6 int b = 12;
(gdb) print a
$1 = 10
(gdb) n
7 int c = a + b;
(gdb) c
Continuing.
Hello World!!!
[Inferior 1 (process 3693) exited normally]
Next step was attaching to gdb process from Netbeans 8.0. I've also put breakpoint in NetBeans in the 5th line hoping I will get gdb output.

Sadly Netbeans is not hitting breakpoint in editor area and I don't know why. I have also opened Debbuger Console and I pasted logs (pastebin) for further informations.
C++ Application
When I created standard C/C++ Application from NetBeans wizard and try debug everything works well.

For that session I've also upload logs.
I have found one difference in logs:
10-file-symbol-file "/usr/bin/gdb"10-file-exec-and-symbols "/home/robert/NetBeansProjects/CppApplication_1/dist/Debug/GNU-Linux-x86/cppapplication_1"So this is a problem with that one line with gradle ? If yes how I can fix it? Can anyone help me with attach NetBeans visual debugger to gradle cpp projects? Thanks for help.
I think the problem in build.gradle so you must check the syntaxes used in gradle program. http://gradle.org/getting-started-native/ this site contain some examples. Read it fix your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With