108

I teach a sort of "lite" C++ programming course to novices ("lite" meaning no pointers, no classes, just plain old C, plus references and STL string and vectors). Students have no previous experience in programming, so I believe that using an interactive debugger would help them understand program flow, variables, and recursion.

The course is taught in Linux. Teaching them to use gdb is just overkill (they will not use nor understand most features). I just need something simple but easy to use: to see at which line the program is now, what is in the stack (local variables, previous calls, etc.). I look something similar to old Turbo Pascal or Turbo C++ Borland's debugger, or Visual Studio debugger.

Thank you,

5 Answers5

37

ddd is a graphical front-end to gdb that is pretty nice. One of the down sides is a classic X interface, but I seem to recall it being pretty intuitive.

Brendan Long
  • 53,280
  • 21
  • 146
  • 188
jbleners
  • 1,023
  • 1
  • 8
  • 14
  • I can't praise DDD enough, but since he says no pointers, you lose much of its' advantage - no need for the top pane in http://www.gnu.org/software/ddd/all.png – Mawg says reinstate Monica Jan 08 '10 at 02:30
  • 2
    DDD really is a great frontend. I used to teach C++. My students never could understand how to use gdb, but after showing them a quick tour of ddd (just the very basics, and telling them to compile with -g) they quickly became much more proficient at debugging their code and understanding what happened. The UI might look "old and dated", but why fix what obviously works? – wasatz May 05 '10 at 14:39
  • 46
    ddd has one of the ugliest UIs I'd ever seen http://imgur.com/UFTBjnW – ubershmekel Mar 06 '13 at 13:13
  • 3
    although I've used ddd a lot for C, it has fairly poor support for vectors and std:: things in general. It regularly requires that I provide the mangled name of something to set up a breakpoint, too. I wouldn't recommend it for students doing their first C++ steps. – PypeBros Jun 29 '13 at 08:43
  • 1
    DDD is great for inspecting data structures because you can lay them out on a big desk and see them how they point to each other and stuff. But it's true that it's only useful for C-style (no STL, pointers everywhere) data. – Roman Plášil May 16 '14 at 01:34
  • DDD sucks. I prefer using gdb in terminal. – tuket Feb 12 '15 at 14:38
  • The in-built file manager seems buggy in linux mint... – PraveenMax May 04 '17 at 14:27
  • 1
    That thing is like 17 years old. – Rolf Feb 11 '18 at 04:09
  • In 2018 you can use visual studio code in combination with gdb to debug your application. https://code.visualstudio.com/docs/languages/cpp or as a video description https://www.youtube.com/watch?v=B0xTgyCwsAo – Marcel Zebrowski Mar 20 '18 at 23:11
26

You could try using Insight a graphical front-end for gdb written by Red Hat Or if you use GNOME desktop environment, you can also try Nemiver.

Brendan Long
  • 53,280
  • 21
  • 146
  • 188
  • 5
    Insight is so awesome but it was removed from Debian and I can't install it on my Linux.. I don't know who's responsible, but he entered my list of mortal enemies and if I encounter him he'll face my wrath! Any-who; there's still a way to get it running but the UI is a little screwed-up: http://www.baptiste-wicht.com/2012/01/install-insight-debugger-linux-mint-ubuntu/ – MasterMastic Nov 07 '12 at 09:03
  • @SamuelLampa apt-get install nemiver – Narek Babajanyan May 24 '13 at 06:16
  • @MasterMastic, it was removed because nobody maintained it, I guess. Don’t worry, you can take it over! – andrewsh Jun 26 '20 at 12:46
16

You may want to check out Eclipse CDT. It provides a C/C++ IDE that runs on multiple platforms (e.g. Windows, Linux, Mac OS X, etc.). Debugging with Eclipse CDT is comparable to using other tools such as Visual Studio.

You can check out the Eclipse CDT Debug tutorial that also includes a number of screenshots.

Jon Ball
  • 3,032
  • 3
  • 23
  • 24
15

Qt Creator, apart from other goodies, also has a good debugger integration, for CDB, GDB and the Symnbian debugger, on all supported platforms. You don't need to use Qt to use the Qt Creator IDE, nor do you need to use QMake - it also has CMake integration, although QMake is very easy to use.

You may want to use Qt Creator as the IDE to teach programming with, consider it has some good features:

  • Very smart and advanced C++ editor
  • Project and build management tools
  • QMake and CMake integration
  • Integrated, context-sensitive help system
  • Excellent visual debugger (CDB, GDB and Symbian)
  • Supports GCC and VC++
  • Rapid code navigation tools
  • Supports Windows, Linux and Mac OS X
CMircea
  • 3,543
  • 2
  • 36
  • 58
  • Does it support debugging small programs that don't have project files? I remember using it for my larger program, but the first setup was pretty painful, although the IDE is very good. – syockit Jan 08 '15 at 14:11
13

Perhaps it is indirect to gdb (because it's an IDE), but my recommendations would be KDevelop. Being quite spoiled with Visual Studio's debugger (professionally at work for many years), I've so far felt the most comfortable debugging in KDevelop (as hobby at home, because I could not afford Visual Studio for personal use - until Express Edition came out). It does "look something similar to" Visual Studio compared to other IDE's I've experimented with (including Eclipse CDT) when it comes to debugging step-through, step-in, etc (placing break points is a bit awkward because I don't like to use mouse too much when coding, but it's not difficult).

HidekiAI
  • 3,013
  • 3
  • 20
  • 22