3

Problem with printing debug text

view full story
linux-howto

http://www.linuxquestions.org – Have succesfully been using the following code to make very helpful debug printouts during the development of a project. Have been running the software on my computer. However, when we run the software of the target hardware (based on an ARM9) and are reading the trace code from the debug port, the hex numbers takes on line each, instead of being all on the same line. If it looks like this while running on my PC (Ubuntu 9.04): /path:function(line#) Data sent 00 01 02 03 it will look like this on the target: /path:function(line#) /path: Data sent /path: 00 /path: 01 /path: 02 /path: 03 Any ideas? Code: #ifdef TARGET #define DEBUG_PRINT_HEX(buf, length, fmt, args...) {int16_t i;  \                                                       DEBUG_PRINT(fmt, ## args); \                                                       for (i = 0; i< length; i++){ \                                                               syslog(LOG_INFO, " %X", buf[i] & 0xFF); \                                                       } \                                                       syslog(LOG_INFO, "\n");} #else #define DEBUG_PRINT_HEX(buf, length, fmt, args...) {int16_t i;  \                                                       DEBUG_PRINT(fmt, ## args); \                                                       for (i = 0; i< length; i++){ \                                                         printf(" %X", buf[i] & 0xFF); \                                                       } \                                                       printf("\n");} #endif #ifdef TARGET #define DEBUG_PRINT(fmt, args...) {syslog(LOG_INFO, "%s:%s(%d) ",__FILE__, __FUNCTION__, __LINE__); syslog(LOG_INFO, fmt, ## args);} #else #define DEBUG_PRINT(fmt, args...) {printf("%s:%s(%d) ",__FILE__, __FUNCTION__, __LINE__); printf(fmt, ## args);} #endif (HowTos)