While reading the Dave’s blog about FUDCon, I was reminded that the mini gdb guide I wrote years ago for my students is woefully inadequate. I have used gdb since my days in university and while it is not the prettiest debugger, I’ve always found that it did what I needed it to do just fine but I don’t think many students are aware of it or make use of it.
While the guide I wrote covers the most common commands, most students still find it difficult to navigate through their code with gdb. I would be interested in rewriting it but I think that it would be useful if the students could try it out on a piece of code that wasn’t their own. Usually students often first try the debugger when they are unable to get their code running for an assignment. Unfortunately this is also usually pushing up against a deadline and learning to use the debugger isn’t on the top of the to-do list… common attitude is to just stumble through assignment with printfs and hope that the bug will get fixed some how. It would be nice if there was a way for students to be able to go through a series of small tutorials where they can go through some buggy code, step through it and learn to use the basic commands.
I would like to know is if anyone out there has some small pieces of code that have some or all of the following feature
- compiles… not interested in syntactic bugs here just logical ones so code with syntax errors are not really what I need.
- clear, easy to understand specs… can’t fix something if we don’t know its broken
but is buggy… in other words it exhibits one or more of the following problems
- crashes (causes a segementation fault)
- gives the wrong result all the time(or unexpected results)
- gives the wrong result sometimes
If you do and don’t mind sharing it, would love to get it so that I’m not inventing a bug.