$OpenBSD: patch-third_party_WebKit_Source_platform_heap_StackFrameDepth_cpp,v 1.7 2016/05/28 14:49:39 robert Exp $
--- third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp.orig.port	Wed May 25 04:54:37 2016
+++ third_party/WebKit/Source/platform/heap/StackFrameDepth.cpp	Thu May 26 08:09:48 2016
@@ -13,6 +13,10 @@
 #elif defined(__GLIBC__)
 extern "C" void* __libc_stack_end;  // NOLINT
 #endif
+#if OS(OPENBSD)
+#include <sys/signal.h>
+#include <pthread_np.h>
+#endif
 
 namespace blink {
 
@@ -104,6 +108,8 @@ size_t StackFrameDepth::getUnderestimatedStackSize()
     //    low as 512k.
     //
     return 512 * 1024;
+#elif OS(OPENBSD)
+    return 512 * 1024;
 #elif OS(MACOSX)
     // pthread_get_stacksize_np() returns too low a value for the main thread on
     // OSX 10.9, http://mail.openjdk.java.net/pipermail/hotspot-dev/2013-October/011369.html
@@ -135,12 +141,18 @@ size_t StackFrameDepth::getUnderestimatedStackSize()
 
 void* StackFrameDepth::getStackStart()
 {
-#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
+#if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD) || OS(OPENBSD)
     pthread_attr_t attr;
     int error;
 #if OS(FREEBSD)
     pthread_attr_init(&attr);
     error = pthread_attr_get_np(pthread_self(), &attr);
+#elif OS(OPENBSD)
+    stack_t ss;
+    void *base;
+    error = pthread_stackseg_np(pthread_self(), &ss);
+    base = (void*)((size_t) ss.ss_sp - ss.ss_size);
+    return reinterpret_cast<Address>(base) + ss.ss_size;
 #else
     error = pthread_getattr_np(pthread_self(), &attr);
 #endif
