Anyone know a good, free debugger for C++?

1.3k Views Asked by At

I've been having a really hard time with those kinds of bugs that just don't make any sense, and an even bigger one with trying to figure out how Code::Blocks' debugger works. If there's any way to make it show pointers' contents, or to be able to switch between scopes' variables, then my problems would be solved already, though alternatives are always welcome.

Help me out guys, scattering couts through the entire code is the most counter-intuitive and insanity-inducing burden ever. D|

edit: OS is Windows

4

There are 4 best solutions below

0
On BEST ANSWER

VS2012 express is free-as-in-beer.

1
On

g++ http://gcc.gnu.org/ "The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages (libstdc++, libgcj,...). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom."

0
On

If there's any way to make it show pointers' contents

Yes. In Code::Blocks in you should be able to right-click and pointer in the Watches list and select 'Dereference pointer'. If the pointer is a member of an object, you may have to add it manually by right-clicking in the Watches list and and typing the full reference to the member.

// Type 'pA->int1' in the 'Add watch' and code::blocks should add it. 
class A {
  public:
    int int1;
};

int main()
{
  A * pA = new A;
}
0
On

To add to other answers (obviously GDB...), LLDB is BSD-style licensed which is more permissive. It is part of the LLVM Compiler Infrastructure. is very similar to GDB (see a comparison).

Following your edit: it is not ready for windows yet but efforts are under way so it should be soon.