How do I debug my program when it hangs ?

From Pinguino
Jump to: navigation, search

Some simple debugging techniques to use with your Pinguino when your program hangs ...

you get "error line XX + message"

  • if line XX exists : take a look at line XX of your program considering the error message you got. The specified line should be highlighted (but not necessarily).
  • if line XX doesn't exist in your program: this is certainly a bug in Pinguino's code. Press F8 to get the output messages from the compiler and report them on the forum to get help.

you get no error message

  • place some breakpoints in your program
#error "*** my program has stopped here ***"
  • place some CDC.printf() in your program to check variables value and get the result by selecting Menu->Pinguino->USB CDC.
CDC.printf("my variable = %d", i); /* print i value */

Available formats are :

Format		Description
%d, %i		signed decimal number.
%u		unsigned decimal number.
%f		floating point notation.
%x, %X		hexadecimal number. 'x' uses lower-case letters and 'X' uses upper-case.
%o		unsigned octal.
%s		null-terminated string.
%c		char (character).