xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Static Public Member Functions | List of all members
xtd::diagnostics::debugger Class Reference

#include <debugger.h>

Definition

Enables communication with a debugger. This class cannot be inherited.

Namespace
xtd::diagnostics
Library
xtd.core

Inherits xtd::static_object.

Static Public Member Functions

static void debug_break ()
 Signals a breakpoint to an attached debugger. More...
 
static bool is_attached ()
 Gets a value that indicates whether a debugger is attached to the process. More...
 
static bool is_logging ()
 Checks to see if logging is enabled by an attached debugger. More...
 
static bool launch ()
 Launches and attaches a debugger to the process. More...
 
static void log (int level, xtd::ustring &category, const xtd::ustring &message)
 Posts a message for the attached debugger. More...
 

Member Function Documentation

◆ debug_break()

static void xtd::diagnostics::debugger::debug_break ( )
static

Signals a breakpoint to an attached debugger.

Examples
The following code example demonstrates how to stop the debugger at the call to write_line.
debugger_break_();
console::write_line("Hello, world.");
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...

◆ is_attached()

static bool xtd::diagnostics::debugger::is_attached ( )
static

Gets a value that indicates whether a debugger is attached to the process.

Returns
true if a debugger is attached; otherwise, false.

◆ is_logging()

static bool xtd::diagnostics::debugger::is_logging ( )
static

Checks to see if logging is enabled by an attached debugger.

Returns
true if a debugger is attached and logging is enabled; otherwise, false.

◆ launch()

static bool xtd::diagnostics::debugger::launch ( )
static

Launches and attaches a debugger to the process.

Returns
true if the startup is successful or if the debugger is already attached; otherwise, false.
Remarks
If a debugger is already attached, nothing happens.
Debugger launch is only supported on Windows. On Unix and macOS operating systems, the method returns true without launching a debugger.

◆ log()

static void xtd::diagnostics::debugger::log ( int  level,
xtd::ustring category,
const xtd::ustring message 
)
static

Posts a message for the attached debugger.

Parameters
levelA description of the importance of the message.
categoryThe category of the message.
messageThe message to show.
Remarks
If there is no debugger attached, this method has no effect. The debugger might or might not report the message, depending upon its settings.
Note
The category parameter is limited to 256 characters. std::string longer than 256 characters are truncated.

The documentation for this class was generated from the following file: