Преглед изворни кода

libobs: Duplicate os_breakpoint to os_oom

Create a specific "out of memory" variant of os_breakpoint to facilitate
troubleshooting and to differentiate an "out of memory" crash from a
more generic crash.
Ryan Foster пре 2 месеци
родитељ
комит
94a736f179
3 измењених фајлова са 11 додато и 0 уклоњено
  1. 5 0
      libobs/util/platform-nix.c
  2. 5 0
      libobs/util/platform-windows.c
  3. 1 0
      libobs/util/platform.h

+ 5 - 0
libobs/util/platform-nix.c

@@ -843,6 +843,11 @@ void os_breakpoint()
 	raise(SIGTRAP);
 }
 
+void os_oom()
+{
+	raise(SIGTRAP);
+}
+
 #ifndef __APPLE__
 static int physical_cores = 0;
 static int logical_cores = 0;

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

@@ -1257,6 +1257,11 @@ void os_breakpoint(void)
 	__debugbreak();
 }
 
+void os_oom(void)
+{
+	__debugbreak();
+}
+
 DWORD num_logical_cores(ULONG_PTR mask)
 {
 	DWORD left_shift = sizeof(ULONG_PTR) * 8 - 1;

+ 1 - 0
libobs/util/platform.h

@@ -174,6 +174,7 @@ 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);
+EXPORT void os_oom(void);
 
 EXPORT int os_get_physical_cores(void);
 EXPORT int os_get_logical_cores(void);