openbsd-ports/www/chromium/patches/patch-base_debug_debugger_posix_cc
robert 2545026841 update to 36.0.1985.125;
from this release Chromium uses Aura instead of Gtk+ so the UI will look
a bit different, and that is completely normal.
2014-07-20 17:22:33 +00:00

63 lines
1.8 KiB
Plaintext

$OpenBSD: patch-base_debug_debugger_posix_cc,v 1.15 2014/07/20 17:22:33 robert Exp $
--- base/debug/debugger_posix.cc.orig.port Tue Jul 15 13:01:12 2014
+++ base/debug/debugger_posix.cc Thu Jul 17 12:25:31 2014
@@ -28,6 +28,10 @@
#include <sys/sysctl.h>
#endif
+#if defined(OS_OPENBSD)
+#include <sys/proc.h>
+#endif
+
#if defined(OS_FREEBSD)
#include <sys/user.h>
#endif
@@ -88,33 +92,38 @@ bool BeingDebugged() {
// Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
// binary interfaces may change.
- struct kinfo_proc info;
- size_t info_size = sizeof(info);
+ struct kinfo_proc *info;
+ size_t info_size;
-#if defined(OS_OPENBSD)
if (sysctl(mib, arraysize(mib), NULL, &info_size, NULL, 0) < 0)
return -1;
+ info = (struct kinfo_proc *)malloc(info_size);
+
mib[5] = (info_size / sizeof(struct kinfo_proc));
-#endif
- int sysctl_result = sysctl(mib, arraysize(mib), &info, &info_size, NULL, 0);
+ int sysctl_result = sysctl(mib, arraysize(mib), info, &info_size, NULL, 0);
DCHECK_EQ(sysctl_result, 0);
if (sysctl_result != 0) {
is_set = true;
being_debugged = false;
- return being_debugged;
+ goto out;
}
// This process is being debugged if the P_TRACED flag is set.
is_set = true;
#if defined(OS_FREEBSD)
- being_debugged = (info.ki_flag & P_TRACED) != 0;
+ being_debugged = (info->ki_flag & P_TRACED) != 0;
+#elif defined(OS_OPENBSD) && !defined(_P_TRACED)
+ being_debugged = (info->p_psflags & PS_TRACED) != 0;
#elif defined(OS_BSD)
- being_debugged = (info.p_flag & P_TRACED) != 0;
+ being_debugged = (info->p_flag & P_TRACED) != 0;
#else
- being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
+ being_debugged = (info->kp_proc.p_flag & P_TRACED) != 0;
#endif
+
+out:
+ free(info);
return being_debugged;
}