Debugging Program

 

While debugging programs, we usually need output devices which can display interim status and data. "lib/lib.c" contains several output functions can be used for displaying messages.

 

 

Console Output

 

This is the simplest way for manually started program. Normally, with printf() in code, output will be shown on console (Telnet and UART console).

 

printf("debug value=%d", var);

 

If stdout is used for other purpose (e.g. cgi), the UART console /dev/ttyS0 can be used:

 

SPrint("debug value=%d", var);

 

 

Virtual Console Output

 

If /dev/ttyS0 console is used by applications, a virtual console /dev/vdd0 can be used:

 

VPrint("debug value=%d", var);

 

You can login with Telnet to see the contents of this virtual console:

 

> cat /dev/vdd0

 

The /dev/vdd0 has 2 KB FIFO (first-in-first-out) buffers.

 

 

SysLog Output

 

If spaces larger than 2 KB are needed, output can be saved to "/var/run/syslog.log".

 

SysLog("debug value=%d", var);

 

You can login with Telnet to see the contents of the file.

 

> cat /var/run/syslog.log

 

The log file takes spaces in the 1 MB RAM FS. You should manage the size of the log by yourself in applications.