How to use DebugView

Using DebugView, you can check the debug output.

YouTube

Procedure

Get DebugView

Download DebugView from the Microsoft website.

DebugView - Windows Sysinternals

You may also download Sysinternals Suite from the download page.
Here, you can also download the other Tools at once.

Sysinternals Utilities - Windows Sysinternals

Prepare a Tool for debugging output (C++ App)

Using Visual Studio, create a new project for a console application (C++).
In it, we added OutputDebugString for debugging output.

#include <iostream>
#include <Windows.h>

void HeavyTask()
{
    Sleep(3000);
}

int main()
{
    OutputDebugString(TEXT("Begin\n"));
    HeavyTask();
    OutputDebugString(TEXT("End\n"));
}

Run

First, start DebugView (Dbgview.exe).

On the other hand, do one of the following on the Tool side for debug output.

  • Do “Start without Debug” in Visual Studio.
    If you do “Start Debugging”, it will show up in “Output” on Visual Studio.
  • Build and then run the exe

Result

Output

Prepare a Tool for debugging output (C# App)

using System;
using System.Diagnostics;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static async Task Main(string[] args)
        {
            Trace.WriteLine("Trace: Begin");
            Debug.WriteLine("Debug: Begin");
            await Task.Delay(3000);
            Trace.WriteLine("Trace: End");
            Debug.WriteLine("Debug: End");
        }
    }
}

Result

For Debug builds.
Both Trace.WriteLine() and Debug.WriteLine() are output.

Output

For Release builds.
Trace.WriteLine()" will be output.

Output

Environment

  • DebugView 4.90
  • Windows 10
  • Visual Studio 2019

What I learned

  • We can use DebugView to check the debug output of the Tool we have created.
  • We can also capture the debug output on a remote computer by running DebugView in agent mode.