The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. // (This file gets included by juce_mac_NativeCode.mm, rather than being
  19. // compiled on its own).
  20. #ifdef JUCE_INCLUDED_FILE
  21. //==============================================================================
  22. void Logger::outputDebugString (const String& text) throw()
  23. {
  24. fputs (text.toUTF8(), stderr);
  25. fputs ("\n", stderr);
  26. }
  27. void Logger::outputDebugPrintf (const tchar* format, ...) throw()
  28. {
  29. String text;
  30. va_list args;
  31. va_start (args, format);
  32. text.vprintf (format, args);
  33. outputDebugString (text);
  34. }
  35. bool JUCE_CALLTYPE juce_isRunningUnderDebugger() throw()
  36. {
  37. static char testResult = 0;
  38. if (testResult == 0)
  39. {
  40. struct kinfo_proc info;
  41. int m[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
  42. size_t sz = sizeof (info);
  43. sysctl (m, 4, &info, &sz, 0, 0);
  44. testResult = ((info.kp_proc.p_flag & P_TRACED) != 0) ? 1 : -1;
  45. }
  46. return testResult > 0;
  47. }
  48. bool JUCE_CALLTYPE Process::isRunningUnderDebugger() throw()
  49. {
  50. return juce_isRunningUnderDebugger();
  51. }
  52. #endif