浏览代码

libobs/util: Add os_breakpoint function

jp9000 10 年之前
父节点
当前提交
fa5c477826
共有 3 个文件被更改,包括 14 次插入1 次删除
  1. 6 1
      libobs/util/platform-nix.c
  2. 6 0
      libobs/util/platform-windows.c
  3. 2 0
      libobs/util/platform.h

+ 6 - 1
libobs/util/platform-nix.c

@@ -26,13 +26,13 @@
 #include <unistd.h>
 #include <glob.h>
 #include <time.h>
+#include <signal.h>
 
 #include "obsconfig.h"
 
 #if !defined(__APPLE__)
 #include <sys/times.h>
 #include <sys/wait.h>
-#include <signal.h>
 #include <spawn.h>
 #endif
 
@@ -591,3 +591,8 @@ void os_inhibit_sleep_destroy(os_inhibit_t *info)
 }
 
 #endif
+
+void os_breakpoint()
+{
+	raise(SIGINT);
+}

+ 6 - 0
libobs/util/platform-windows.c

@@ -18,6 +18,7 @@
 #include <mmsystem.h>
 #include <shellapi.h>
 #include <shlobj.h>
+#include <intrin.h>
 
 #include "base.h"
 #include "platform.h"
@@ -771,3 +772,8 @@ void os_inhibit_sleep_destroy(os_inhibit_t *info)
 		bfree(info);
 	}
 }
+
+void os_breakpoint(void)
+{
+	__debugbreak();
+}

+ 2 - 0
libobs/util/platform.h

@@ -158,6 +158,8 @@ EXPORT os_inhibit_t *os_inhibit_sleep_create(const char *reason);
 EXPORT bool os_inhibit_sleep_set_active(os_inhibit_t *info, bool active);
 EXPORT void os_inhibit_sleep_destroy(os_inhibit_t *info);
 
+EXPORT void os_breakpoint(void);
+
 #ifdef _MSC_VER
 #define strtoll _strtoi64
 #if _MSC_VER < 1900