xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
Classes | Macros
debug

Definition

All needed for debugging and tracing.

Classes

class  xtd::diagnostics::console_trace_listener
 Directs tracing or debugging output to either the standard output or the standard error stream. More...
 
class  xtd::diagnostics::debug
 Provides a set of methods and properties that help you debug the execution of your code. This class cannot be inherited. More...
 
class  xtd::diagnostics::debugger
 Enables communication with a debugger. This class cannot be inherited. More...
 
class  xtd::diagnostics::default_trace_listener
 Provides the default output methods and behavior for tracing. More...
 
class  xtd::diagnostics::ostream_trace_listener
 Directs tracing or debugging output to a std::ostream, such as std::fstream, std::stream... More...
 
class  xtd::diagnostics::stack_frame
 Provides information about a xtd::diagnostics::stack_frame, which represents a function call on the call stack for the current thread. More...
 
class  xtd::diagnostics::stack_trace
 Represents a stack trace, which is an ordered collection of one or more stack frames. More...
 
class  xtd::diagnostics::trace
 Provides a set of methods and properties that help you debug the execution of your code. This class cannot be inherited. More...
 
class  xtd::forms::control_trace_listener
 Directs tracing or debugging output to a icontrol_trace object. More...
 
class  xtd::forms::debug_form
 Represents a form that displays debug form. This class cannot be inherited. More...
 
class  xtd::forms::debug_message_box
 Displays a dialog box and write debug. More...
 
class  xtd::forms::enable_debug
 Represent enable debug class. More...
 
class  xtd::forms::trace_form
 Represents a form that displays trace form. This class cannot be inherited. More...
 
class  xtd::forms::trace_form_base
 Represents a base form for debug_form and trace_form forms. This class cannot be instantiated. More...
 
class  xtd::forms::trace_message_box
 Displays a dialog box and write trace. More...
 

Macros

#define assert_(...)
 Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
#define cassert_(...)
 Checks for a condition; if the condition is false, displays a message box that shows the call stack.
 
#define debug_break_()
 Signals a breakpoint to an attached debugger.
 

Macro Definition Documentation

◆ assert_

#define assert_ (   ...)

#include <xtd.core/include/xtd/diagnostics/debug.h>

Checks for a condition; if the condition is false, displays a message box that shows the call stack.

Library
xtd.core
Parameters
conditionThe conditional expression to evaluate. If the condition is true, a failure message is not sent and the message box is not displayed.
message(optional) The message to send to the xtd::diagnostics::debug::listeners collection.
Examples
The following example shows how to use assert_ macro.
#include <xtd/xtd>
using namespace xtd;
int main() {
// Uncomment following line to remove assert dialog
//diagnostics::debug::show_assert_dialog(false);
auto index = 0;
console::write_line("Start application");
assert_(index > 0);
console::write_line("End application");
}
// This code produces the following output :
//
// > If user clicks assert dialog 'Abort' button:
// Start application
//
// > If user clicks assert dialog 'Retry' button:
// Start application
// > Break the debugger on file assert_.cpp line 11.
// > If user choose continue running after break.
// End application
//
// > If user clicks assert dialog 'Ignore' button:
// Start application
// End application
#define assert_(...)
Checks for a condition; if the condition is false, displays a message box that shows the call stack.
Definition debug.h:494
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Examples
The following example shows how to use assert_ macro with message.
#include <xtd/xtd>
using namespace xtd;
int main() {
// Uncomment following line to remove assert dialog
//diagnostics::debug::show_assert_dialog(false);
auto index = 0;
console::write_line("Start application");
assert_(index > 0, "index must be greater than 0");
console::write_line("End application");
}
// This code produces the following output :
//
// > If user clicks assert dialog 'Abort' button:
// Start application
//
// > If user clicks assert dialog 'Retry' button:
// Start application
// > Break the debugger on file assert_with_message.cpp line 11.
// > If user choose continue running after break.
// End application
//
// > If user clicks assert dialog 'Ignore' button:
// Start application
// End application

◆ cassert_

#define cassert_ (   ...)

#include <xtd.core/include/xtd/diagnostics/debug.h>

Checks for a condition; if the condition is false, displays a message box that shows the call stack.

Library
xtd.core
Parameters
conditionThe conditional expression to evaluate. If the condition is true, a failure message is not sent and the message box is not displayed.
message(optional) The message to send to the xtd::diagnostics::debug::listeners collection.
Usage
This assert can only call by xtd::diagnostics::debug and xtd::diagnostics::trace like this :
  • xtd::diagnostics::debug::cassert_();
  • xtd::diagnostics:trace::cassert_();
Examples
The following example shows how to use xtd::diagnostics::debug::cassert_ method.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::diagnostics;
int main() {
// Uncomment following line to remove assert dialog
//diagnostics::debug::show_assert_dialog(false);
auto index = 0;
console::write_line("Start application");
debug::cassert_(index > 0);
console::write_line("End application");
}
// This code produces the following output :
//
// > If user clicks assert dialog 'Abort' button:
// Start application
//
// > If user clicks assert dialog 'Retry' button:
// Start application
// > Break the debugger on file debug_cassert.cpp line 12.
// > If user choose continue running after break.
// End application
//
// > If user clicks assert dialog 'Ignore' button:
// Start application
// End application
The xtd::diagnostics namespace provides classes that allow you to interact with system processes,...
Definition assert_dialog_result.h:10
Examples
The following example shows how to use xtd::diagnostics::trace::cassert_ method.
#define TRACE
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::diagnostics;
int main() {
// Uncomment following line to remove assert dialog
//diagnostics::debug::show_assert_dialog(false);
auto index = 0;
console::write_line("Start application");
trace::cassert_(index > 0, "index must be greater than 0");
console::write_line("End application");
}
// This code produces the following output :
//
// > If user clicks assert dialog 'Abort' button:
// Start application
//
// > If user clicks assert dialog 'Retry' button:
// Start application
// > Break the debugger on file tace_cassert.cpp line 13.
// > If user choose continue running after break.
// End application
//
// > If user clicks assert dialog 'Ignore' button:
// Start application
// End application

◆ debug_break_

#define debug_break_ ( )

#include <xtd.core/include/xtd/diagnostics/debugger.h>

Signals a breakpoint to an attached debugger.

Library
xtd.core
Examples
The following code example demonstrates how to stop the debugger at the call to write_line.
console::write_line("Hello, world.");
#define debug_break_()
Signals a breakpoint to an attached debugger.
Definition debugger.h:91