Debugger.h 2.1 KB

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