Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Netbeans IDE 7.0.1 for C++, how to enable more debugging information (i.e. as with "-g3" with gdb)

As mentioned in the title, I am using NetBeans IDE 7.0.1 for C++ (for the assignments at the university). I was using gedit and terminal, but I would like to try my hand at IDEs.
I tried Eclipse but I seem to prefer Netbeans interface.
(All the above->with my laptop, running Ubuntu 11.10).

Well, I have some questions,

  • Is there any way to "enrich" the "RUN FAILED (exit value 1, total time: 470ms)" message with a "Segmentation fault", as well? (or this is how the IDEs work, run and if you get a "run failed" go to debug mode?)
  • Also, at debug mode, when I get a segmentation fault I get a new window saying "Signal Caught" and then this:

    Signal received: SIGSEGV (?) with sigcode ? (?)
    From process: ?
    For program testing_netbeans, pid 15,211
    You may discard the signal or forward it and you may continue or pause the process
    To control which signals are caught or ignored use Debug->Dbx Configure
    

    with three options available ("Discard and Pause", "Discard and Continue", "Forward and Continue"). What do each of the above options do?

    How is it possible to get the line where the error occurs? (in example with gdb I would compile with -g3 option and then run with gdb. But now how can I do that by default?

  • What I did like about eclipse is the fact that it would have a default breakpoint at the 1st line of the main function, is there any way to do that by default?

Thank you for your time!

like image 599
Chris Avatar asked Jan 26 '12 00:01

Chris


1 Answers

The compiler flag is -ggdb. It allows you to use breakpoints, know the values of variables and etc.

If you are just building in "debug mode", you will get minimal information, such as line of crash by opening the "call stack" page.

Eclipse is a bit better for debugging, but as an editor, I much prefer Netbeans over it for C++, while I prefer Eclipse for Java

EDIT: Also, you have to have setupped GDB as the debugger in Netbeans, but I'm pretty that's done by default.

like image 193
JCMS Avatar answered Nov 15 '22 00:11

JCMS