Live data from Hacker News

Learning C with gdb

hackerschool.com

1–10 of 98 posts

Re: Learning C with gdb

#5
post #3

Here's a more full-featured C++ REPL: http://root.cern.ch/drupal/content/what-cling

...except, that it isn't C++ standard compliant, and you are worse off than when you started out. "full-featured C++" is misleading.

http://www.insectnation.org/howto/living-without-root

https://linuxfr.org/nodes/18919/comments/632920

http://comments.gmane.org/gmane.comp.lang.c%2B%2B.root/5924

Re: Learning C with gdb

#6
There was a debugger posted here to HN awhile back that actually displayed structs and pointers graphically. What was the name of that project, and is it still around? I was trying to find it the other day. I thought that was a dynamite tool for students.

With LLVM, we should be able to have a REPL for C. as a pedagogical tool.

Re: Learning C with gdb

#7

There was a debugger posted here to HN awhile back that actually displayed structs and pointers graphically. What was the name of that project, and is it still around? I was trying to find it the other day. I thought that was a dynamite tool for students. With LLVM, we should be able to have a REPL for C. as a pedagogical tool.

Maybe ddd?

https://www.gnu.org/software/ddd/

Re: Learning C with gdb

#9
This is pretty neat, though I found myself doing similar things in small test files when I was first learning C and printing the results. C compile times suck, but with like a 10 line program or so to toy with a language semantic, it was practically instant (in 2007). But then again I had never used a dynamic language like Ruby/Python before then so I didn't know better.

More people should be hopping on this bandwagon though because debuggers are awesome. I typically find myself using `po` the most in LLDB (Xcode, iOS development) but it's insanely useful especially when Xcode refuses to show me the values of something I want in the Variables View, ex. NSDictionary keys/values, objects in an NSArray, etc. I'll also use it sometimes to execute simple commands like `[myArrayObject count]` when the Variables View refuses to show me property values. Sometimes Xcode's GUI bits just don't cut it!

There's more info on what you can do with LLDB here: http://lldb.llvm.org/tutorial.html

And if you've used GDB, this might be of use: http://lldb.llvm.org/lldb-gdb.html

Re: Learning C with gdb

#10
GDB skills are one of those super useful abilities that you just can't find in most CS graduates. I often spend a few days with new C developers just teaching them how to use GDB to find problems. They are amazed when they find out you can examine variables and set conditional breakpoints.
Post reply on HN