Tue 23 March 2010

Tipp: verbose logging

Bevor man stundenlang nach scheinbar obskuren Fehlern sucht: Einfach einmal schauen, ob die Software detailiertere Logging-Optionen kennt und dann den Log aufmerksam lesen.

Thu 30 July 2009

Hardwarebreakpoints und GDB

Wenn man sich wundert, wie man mit gdb lustig Hardwarebreakpoints setzen kann, obwohl x86 eigentlich nur vier unterstützt: Die Manual klärt auf.

Since they depend on hardware resources, hardware breakpoints may be limited in number; when the user asks for more, GDB will start trying to set software breakpoints. (On some architectures, notably the 32-bit x86 platforms, GDB cannot always know whether there's enough hardware resources to insert all the hardware breakpoints and watchpoints. On those platforms, GDB prints an error message only when the program being debugged is continued.)


Tue 10 March 2009

Rubber Duck method of debugging

  1. Beg, borrow, steal, buy, fabricate or otherwise obtain a rubber duck (bathtub variety)

  2. Place rubber duck on desk and inform it you are just going to go over some code with it, if that's all right.

  3. Explain to the duck what you code is supposed to do, and then go into detail and explain things line by line

  4. At some point you will tell the duck what you are doing next and then realise that that is not in fact what you are actually doing. The duck will sit there serenely, happy in the knowledge that it has helped you on your way.

Works every time. Actually, if you don't have a rubber duck you could at a pinch ask a fellow programmer or engineer to sit in.