tags:

views:

181

answers:

5

I'm trying to debug my code. I haven't really used a debugger before. I know that in the long run, learning how to use a debugger will be very, very helpful, so I'm trying to find one that suits me. Are there any newbie-friendly debuggers for C++? Ideally with a good GUI...

If not, can anyone point me to a good, newbie-friendly guide to using gdb? My prof recommended it, but it seems to have somewhat of a steep learning curve (at least, for me) since I don't know what to look out for and how to use it. I've tried googling, but I can't seem to find a decent guide.

In short, I just want to set breakpoints and step through the code while checking the values that are being assigned into my variables. Also, being able to view my code while debugging would be awesome.

If its of any importance, I'm running on a mac, and I have gdb installed. I use the NetBeans IDE to code with, and it debugs with gdb (I think), but I don't know how to use it. I have finally decided on trying out a debugger instead of spot-checking my code. I've spent too many hours pulling my hair out on my current programming project. (I'm trying to make an AVL Tree, for those of you who are interested :D)

Thanks!

+1  A: 

A good tutorial that helped me was: http://www.cs.cmu.edu/~gilpin/tutorial/

Of course that one is a very basic one that can help you start quickly. For a more complete documentation please turn to http://www.delorie.com/gnu/docs/gdb/gdb_toc.html

Bobby
I really want to learn how to use gdb effectively... just not right now :) If the GUI debuggers mentioned in the other answers don't work, I'll have to clench my teeth and gdb it (although it seems like the other GUI's are just built on top of gdb anyways...)Thank you for the links, I've bookmarked them.
veol
+3  A: 

If you are having troubles with the UI of GDB, try DDD. It is a graphical front-end for debuggers like GDB, and has quite a number of nice features. You can see a sample session of it here.

Nikwin
Thank you. I believe i remember hearing that DDD is installed on our school computers, but I completely forgot about it. I guess learning DDD would be the best choice for me right now.
veol
Isn't DDD total crap? At least that was the conclusion I arrived to after trying it out 2.5 years ago.
StackedCrooked
+1  A: 

I recently tried the GUI Insight for GDB and I liked it very much.

sellibitze
I'll have to give Insight a shot if DDD fails me. :)
veol
+1  A: 

The IDE Code::Blocks integrates gdb into its GUI pretty decently.

int3
I've tried Code::Blocks - I had stability issues, and I had trouble setting up the compiler to work with it. Decided on using NetBeans, which feels more refined (at least, to me) than Code::Blocks.
veol
+1  A: 

If you are on Mac you should use XCode, if it is not already installed on your system then you can get it from the "Extra tools" disc that came with your Mac.

XCode provides a user-friendly GUI on top of GDB. So you can focus on debugging your code instead of learning an arcane set of commands. And if you really want to dig deeper you can using the GDB console.

StackedCrooked
XCode just doesn't want to work properly with me. I think I'll have to reinstall it. Its been giving me problems from the get-go, which is why I started using NetBeans.
veol