Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: base/debug/debugger_posix.cc

Issue 8329023: OpenBSD patches for base / split from CR #8275005 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: for the buildbot Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gypi ('k') | base/process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/debugger_posix.cc
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index 8b4c8f1280a8e4813343096c7be316a5a285c351..1802dbb26f6f47c3d9fa0fce8d842a64a9430254 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -59,7 +59,7 @@ bool SpawnDebuggerOnProcess(unsigned /* process_id */) {
return false;
}
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_OPENBSD)
// Based on Apple's recommended method as described in
// http://developer.apple.com/qa/qa2004/qa1361.html
@@ -80,6 +80,10 @@ bool BeingDebugged() {
KERN_PROC,
KERN_PROC_PID,
getpid()
+#if defined(OS_OPENBSD)
+ , sizeof(struct kinfo_proc),
+ 0
+#endif
};
// Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
@@ -87,6 +91,13 @@ bool BeingDebugged() {
struct kinfo_proc info;
size_t info_size = sizeof(info);
+#if defined(OS_OPENBSD)
+ if (sysctl(mib, arraysize(mib), NULL, &info_size, NULL, 0) < 0)
+ return -1;
+
+ mib[5] = (info_size / sizeof(struct kinfo_proc));
+#endif
+
int sysctl_result = sysctl(mib, arraysize(mib), &info, &info_size, NULL, 0);
DCHECK_EQ(sysctl_result, 0);
if (sysctl_result != 0) {
@@ -97,7 +108,11 @@ bool BeingDebugged() {
// This process is being debugged if the P_TRACED flag is set.
is_set = true;
+#if defined(OS_OPENBSD)
+ being_debugged = (info.p_flag & P_TRACED) != 0;
+#else
being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
+#endif
return being_debugged;
}
« no previous file with comments | « base/base.gypi ('k') | base/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698