Debugger.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. #ifndef Foundation_Debugger_INCLUDED
  16. #define Foundation_Debugger_INCLUDED
  17. #include "Poco/Foundation.h"
  18. namespace Poco {
  19. class Foundation_API Debugger
  20. /// The Debugger class provides an interface to the debugger.
  21. /// The presence of a debugger can be checked for,
  22. /// messages can be written to the debugger's log window
  23. /// and a break into the debugger can be enforced.
  24. /// The methods only work if the program is compiled
  25. /// in debug mode (the macro _DEBUG is defined).
  26. {
  27. public:
  28. static bool isAvailable();
  29. /// Returns true if a debugger is available, false otherwise.
  30. /// On Windows, this function uses the IsDebuggerPresent()
  31. /// function.
  32. /// On Unix, this function returns true if the environment
  33. /// variable POCO_ENABLE_DEBUGGER is set.
  34. static void message(const std::string& msg);
  35. /// Writes a message to the debugger log, if available, otherwise to
  36. /// standard error output.
  37. static void message(const std::string& msg, const char* file, int line);
  38. /// Writes a message to the debugger log, if available, otherwise to
  39. /// standard error output.
  40. static void enter();
  41. /// Breaks into the debugger, if it is available.
  42. /// On Windows, this is done using the DebugBreak() function.
  43. /// On Unix, the SIGINT signal is raised.
  44. static void enter(const std::string& msg);
  45. /// Writes a debug message to the debugger log and breaks into it.
  46. static void enter(const std::string& msg, const char* file, int line);
  47. /// Writes a debug message to the debugger log and breaks into it.
  48. static void enter(const char* file, int line);
  49. /// Writes a debug message to the debugger log and breaks into it.
  50. };
  51. } // namespace Poco
  52. #endif // Foundation_Debugger_INCLUDED