Search by Tags

Debug Message Buffer


Compare with Revision

Subscribe for this article updates

Only Colibri PXAxxx BSP 4.1 and higher, not supported on Colibri Tegra yet.

The bootloader and Windows CE use a special ring-buffer in RAM to store the debug messages. These messages can be read through the tool ColibriDbgMsgLogger or by accessing the RAM buffer directly by an application.

Controlling the Debug Message Buffer

The size of this buffer is fix 2k in the bootloader and adjustable for Windows CE (10k default). The following registry key lets you change the size or even disable the feature:

"DbgMsgBufSize"  =   dword:0x00002800     ;buffer size in bytes, 0=feature disabled, 0x2800=10k(default)

Show the Debug Message Buffer Content

See Colibri Debug Message Logger for details.

Access the Debug Message Buffer from an Application

The debug message buffer is implemented as a memory mapped file. The following code snippet demonstrates the access to this buffer.

// Struct used for the debug message buffer
typedef struct {
    DWORD version;                         // version of the message buffer
    DWORD bufSize;                         // message buffer size, w/o header bytes (this means size starting from buf offest)
    DWORD head;                            // head pointer which points to the character which gets written next
    DWORD flags;                           // see flag description below
    DWORD reserved[3];                     // reserved, do not use
    char buf[];                            // start of the debug message buffer (ring buffer)
// flag definitions
#define DBGMSGBUF_F_OVERFLOW  (1<< 0)      // set (1) means, there was at least one wrap around performed on the message buffer
// C code (no error handling done, more information about the used Windows APIs can be found on MSDN)
HANDLE hMapFile;
hMapFile= CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READONLY, 0, 0, L"DbgMsgBuffer");
pDbgMsgBuf = (DBGMSGBUF*) MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
// start using the debug message buffer. e.g.
if(pDbgMsgBuf->version != 1)