开发者

Any tips for a newbie who wants to find a good debugger for C++?

开发者 https://www.devze.com 2022-12-10 15:50 出处:网络
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 开发者_JS百科debugger will be very, very helpful, so I\'m trying to find one

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 开发者_JS百科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!


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.


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


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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消