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 /// On OpenVMS, this function always returns true in debug,
43 /// mode, false otherwise.
44
45 static void message(const std::string& msg);
46 /// Writes a message to the debugger log, if available, otherwise to
47 /// standard error output.
48
49 static void message(const std::string& msg, const char* file, int line);
50 /// Writes a message to the debugger log, if available, otherwise to
51 /// standard error output.
52
53 static void enter();
54 /// Breaks into the debugger, if it is available.
55 /// On Windows, this is done using the DebugBreak() function.
56 /// On Unix, the SIGINT signal is raised.
57 /// On OpenVMS, the SS$_DEBUG signal is raised.
58
59 static void enter(const std::string& msg);
60 /// Writes a debug message to the debugger log and breaks into it.
61
62 static void enter(const std::string& msg, const char* file, int line);
63 /// Writes a debug message to the debugger log and breaks into it.
64
65 static void enter(const char* file, int line);
66 /// Writes a debug message to the debugger log and breaks into it.
67};
68
69
70} // namespace Poco
71
72
73#endif // Foundation_Debugger_INCLUDED
74