DebugView打印列显示“????”

时间:2015-03-09 21:46:49

标签: c++ debugging debugview

当使用以下代码在Windows 7机器上调用OutputDebugString时,我只看到“????”在DebugView的打印列中。我认为这可能是一个编码相关的问题,但不确定是否有人以前见过这个。这是我用来调用OutputDebugString的代码。

void dbgprint(char *format, ...)
{
    static  DWORD pid=0;
    va_list vl;
    char    dbgbuf1[2048],
            dbgbuf2[2048];

    // Prepend the process ID to the message
    if ( 0 == pid )
    {
        pid = GetCurrentProcessId();
    }

    EnterCriticalSection(&gDebugCritSec);
    va_start(vl, format);
    wvsprintf(dbgbuf1, format, vl);
    wsprintf(dbgbuf2, "%lu: %s\r\n", pid, dbgbuf1);
    va_end(vl);

    OutputDebugString(dbgbuf2);
    LeaveCriticalSection(&gDebugCritSec);
}

enter image description here

提前感谢您对此问题的任何见解。

1 个答案:

答案 0 :(得分:1)

正如您所说,它可能是编码问题。 只需测试它:

OutputDebugStringA("这是非unicode测试");

还有两件事,

  1. 您不必为PID添加前缀,因为OutputDebugString 将消息与消息一起发送。
  2. https://github.com/djeedjay/DebugViewPP
  3. 上查看DebugView ++