Learning C with GDB

“Coming from a background in higher-level languages like Ruby, Scheme, or Haskell, learning C can be challenging. In addition to having to wrestle with C’s lower-level features like manual memory management and pointers, you have to make do without a REPL. Once you get used to exploratory programming in a REPL, having to deal with the write-compile-run loop is a bit of a bummer. It occurred to me recently that I could use gdb as a pseudo-REPL for C. I’ve been experimenting with using gdb as a tool for learning C, rather than merely debugging C, and it’s a lot of fun. My goal in this post is to show you that gdb is a great tool for learning C. I’ll introduce you to a few of my favorite gdb commands, and then I’ll demonstrate how you can use gdb to understand a notoriously tricky part of C: the difference between arrays and pointers.”

22 Comments

  1. 2012-08-28 7:50 pm
  2. 2012-08-28 8:14 pm
    • 2012-08-28 8:21 pm
      • 2012-08-29 9:20 am
    • 2012-08-28 11:32 pm
  3. 2012-08-28 9:01 pm
  4. 2012-08-29 2:21 am
    • 2012-08-29 7:42 am
    • 2012-08-29 8:24 am
      • 2012-08-29 8:45 am
    • 2012-08-29 8:19 pm
  5. 2012-08-29 6:53 am
    • 2012-08-29 8:21 pm
  6. 2012-08-29 7:56 am
    • 2012-08-29 8:38 am
      • 2012-08-29 10:21 am
        • 2012-08-29 11:29 am
          • 2012-08-29 11:53 am
          • 2012-08-29 11:57 am
          • 2012-08-29 12:04 pm
  7. 2012-08-29 8:28 pm
  8. 2012-08-30 3:41 am