The idea for this post started after I’ve read Jonathan Blow: Cost of Switching to Linux is Too High for a Game Developer article.
Jonathan Blow states:
The main reason is that debugging is terrible on Linux.
and i find this ridiculous for many reasons. Other claims in this article are ridiculous as well, but to the point.
I’m amazed how few people know how easy is to use Eclipse as a frontend to GNU Debugger and how well it works. The only reason I personally don’t use Eclipse + GDB combo is because I’m a hardcore commandline guy and I spend my days in ZSH, Vim and plain GDB. And I have a handy script for literally everything that is repetitive.
So I’ve decided to write a simple guide on how to get started plus add some nice screenshots as a teaser.
Short Eclipse plus GDB guide
I guess most Linux distributions provide Eclipse in their package repositories, but for the reproductivity we will use standalone build.
So, go to Eclipse downloads and grap and grab the Eclipse IDE for C/C++ Developers, Linux 64-bit version.
Extract it, and
cd to a resulting directory. Run
./eclipse. Create a workspace,
then click File –> New –> C Project…. Select the following options:
and click Finish.
This will create an example C project, but you can just as easily create C++ project or import an existing project. The Eclipse project configuration options allow using custom toolchains and building systems, change building environment variables values and have many, many other features, so any project should work with Eclipse just fine.
This will open a nice Eclipse C/C++ IDE that is very handy and well featured, in case you’re looking for one. Here you can build your project:
and here you can start debugging it:
After opening the Debugger view will show up. It’s a intuitive, easy to use, full-featured modern debugger. It support stepping (also machine instruction-level stepping), traps, breakpoints, shows the code that’s being executed, local variables, calling stack, etc. In the Window –> Show View you can turn on the Dissasembler as well as Registers views.
See for yourself:
So, if you really prefer Graphic UI GDB experience, using Eclipse is the way to go.