0

OpenBSD patches for base / split from CR

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
This commit is contained in:
mark@chromium.org
2011-10-18 17:41:07 +00:00
parent 56d8fba03a
commit 88b49f718b
5 changed files with 37 additions and 8 deletions

@ -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',

@ -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;
}

@ -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()

@ -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>

@ -260,7 +260,7 @@
'<!@(<(pkg-config) --libs-only-l gio-2.0)',
],
'conditions': [
['linux_link_gsettings==0', {
['linux_link_gsettings==0 and OS=="linux"', {
'libraries': [
'-ldl',
],
@ -387,11 +387,15 @@
],
},
}, {
'link_settings': {
'libraries': [
'-ldl',
],
},
'conditions': [
['OS=="linux"', {
'link_settings': {
'libraries': [
'-ldl',
],
},
}],
],
}],
],
}],