xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
debugger.h
Go to the documentation of this file.
1
4#pragma once
5#include <cstdint>
6#include <cstdlib>
7#include <mutex>
8#include "../core_export.h"
9#include "../static.h"
10#include "../ustring.h"
11
13// Workaround : the std::abort function on Visual Studio shows a message box.
14#if defined(_MSC_VER)
15#define __std_abort__ __debugbreak
16#else
17#define __std_abort__ std::abort
18#endif
20
22namespace xtd {
24 namespace diagnostics {
32 public:
35 static bool is_attached();
36
44 static void debug_break();
45
48 static bool is_logging();
49
54 static bool launch();
55
62 static void log(int level, xtd::ustring& category, const xtd::ustring& message);
63 };
64 }
65}
66
67#if defined(_MSC_VER)
78#define debug_break_() \
79 if (xtd::diagnostics::debugger::launch()) __debugbreak()
80#else
91#define debug_break_() \
92 if (xtd::diagnostics::debugger::launch()) std::abort()
93#endif
Enables communication with a debugger. This class cannot be inherited.
Definition: debugger.h:31
static void debug_break()
Signals a breakpoint to an attached debugger.
static bool is_attached()
Gets a value that indicates whether a debugger is attached to the process.
static bool is_logging()
Checks to see if logging is enabled by an attached debugger.
static void log(int level, xtd::ustring &category, const xtd::ustring &message)
Posts a message for the attached debugger.
static bool launch()
Launches and attaches a debugger to the process.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition: static.h:38
#define core_export_
Define shared library export.
Definition: core_export.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17