summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 17:41:07 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 17:41:07 +0000
commit88b49f718bcb6fa1aea657ab1d33734c0cd52789 (patch)
treeead37a5220721544fa451437594db599ac46047b /base
parent56d8fba03ada4f821435d5a3f2a25ba57f07c31e (diff)
downloadchromium_src-88b49f718bcb6fa1aea657ab1d33734c0cd52789.zip
chromium_src-88b49f718bcb6fa1aea657ab1d33734c0cd52789.tar.gz
chromium_src-88b49f718bcb6fa1aea657ab1d33734c0cd52789.tar.bz2
OpenBSD patches for base / split from CR #8275005
base/base.gypi: - Add native_library_linux.cc to the openbsd build. - Add '..' to include_dirs so that OS_* definitions are available in symbolize.cc base/debug/debugger_posix.cc: - Add support for figuring out if the process is being debugged on OpenBSD by sharing some code with Mac. base/process_util_unittest.cc: - Disable the OutOfMemoryTest on OpenBSD base/third_party/symbolize/symbolize.cc: - Include the correct elf header on OpenBSD build/linux/system.gyp: - The dl library is linux only, so only use it there. BUG= TEST= Review URL: http://codereview.chromium.org/8329023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gypi4
-rw-r--r--base/debug/debugger_posix.cc17
-rw-r--r--base/process_util_unittest.cc3
-rw-r--r--base/third_party/symbolize/symbolize.cc5
4 files changed, 27 insertions, 2 deletions
diff --git a/base/base.gypi b/base/base.gypi
index c7475ba..b3a97af 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -501,6 +501,7 @@
[ 'OS == "openbsd"', {
'sources/': [
['include', '^base_paths_linux\\.cc$'],
+ ['include', '^native_library_linux\\.cc$'],
['include', '^sys_string_conversions_linux\\.cc$'],
],
}],
@@ -784,6 +785,9 @@
'third_party/symbolize/symbolize.cc',
'third_party/symbolize/demangle.cc',
],
+ 'include_dirs': [
+ '..',
+ ],
},
{
'target_name': 'xdg_mime',
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index 8b4c8f1..1802dbb 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;
}
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 5f75b2e..8f6def9 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -846,7 +846,8 @@ int tc_set_new_mode(int mode);
// Android doesn't implement set_new_handler, so we can't use the
// OutOfMemoryTest cases.
-#if !defined(OS_ANDROID)
+// OpenBSD does not support these tests either.
+#if !defined(OS_ANDROID) && !defined(OS_OPENBSD)
class OutOfMemoryDeathTest : public testing::Test {
public:
OutOfMemoryDeathTest()
diff --git a/base/third_party/symbolize/symbolize.cc b/base/third_party/symbolize/symbolize.cc
index 0a1ba6c..f765fae 100644
--- a/base/third_party/symbolize/symbolize.cc
+++ b/base/third_party/symbolize/symbolize.cc
@@ -46,6 +46,7 @@
// and memmove(). We assume they are async-signal-safe.
//
+#include "build/build_config.h"
#include "utilities.h"
#if defined(HAVE_SYMBOLIZE)
@@ -95,7 +96,11 @@ _END_GOOGLE_NAMESPACE_
#if defined(__ELF__)
#include <dlfcn.h>
+#if defined(OS_OPENBSD)
+#include <sys/exec_elf.h>
+#else
#include <elf.h>
+#endif
#include <errno.h>
#include <fcntl.h>
#include <limits.h>