1//
2// Debugger.h
3//
4// Library: Foundation
5// Package: Core
6// Module: Debugger
7//
8// Definition of the Debugger class.
9//
10// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
11// and Contributors.
12//
13// SPDX-License-Identifier: BSL-1.0
14//
15
16
17#ifndef Foundation_Debugger_INCLUDED
18#define Foundation_Debugger_INCLUDED
19
20
21#include "Poco/Foundation.h"
22
23
24namespace Poco {
25
26
27class Foundation_API Debugger
28 /// The Debugger class provides an interface to the debugger.
29 /// The presence of a debugger can be checked for,
30 /// messages can be written to the debugger's log window
31 /// and a break into the debugger can be enforced.
32 /// The methods only work if the program is compiled
33 /// in debug mode (the macro _DEBUG is defined).
34{
35public:
36 static bool isAvailable();
37 /// Returns true if a debugger is available, false otherwise.
38 /// On Windows, this function uses the IsDebuggerPresent()
39 /// function.
40 /// On Unix, this function returns true if the environment
41 /// variable POCO_ENABLE_DEBUGGER is set.
42
43 static void message(const std::string& msg, bool backTrace = true);
44 /// Writes a message to the debugger log, if available, otherwise to
45 /// standard error output.
46
47 static void message(const std::string& msg, const char* file, int line);
48 /// Writes a message to the debugger log, if available, otherwise to
49 /// standard error output.
50
51 static void enter();
52 /// Breaks into the debugger, if it is available.
53 /// On Windows, this is done using the DebugBreak() function.
54 /// On Unix, the SIGINT signal is raised.
55
56 static void enter(const std::string& msg);
57 /// Writes a debug message to the debugger log and breaks into it.
58
59 static void enter(const std::string& msg, const char* file, int line);
60 /// Writes a debug message to the debugger log and breaks into it.
61
62 static void enter(const char* file, int line);
63 /// Writes a debug message to the debugger log and breaks into it.
64};
65
66
67} // namespace Poco
68
69
70#endif // Foundation_Debugger_INCLUDED
71