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
This commit is contained in:
base
build/linux
@ -501,6 +501,7 @@
|
|||||||
[ 'OS == "openbsd"', {
|
[ 'OS == "openbsd"', {
|
||||||
'sources/': [
|
'sources/': [
|
||||||
['include', '^base_paths_linux\\.cc$'],
|
['include', '^base_paths_linux\\.cc$'],
|
||||||
|
['include', '^native_library_linux\\.cc$'],
|
||||||
['include', '^sys_string_conversions_linux\\.cc$'],
|
['include', '^sys_string_conversions_linux\\.cc$'],
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
@ -784,6 +785,9 @@
|
|||||||
'third_party/symbolize/symbolize.cc',
|
'third_party/symbolize/symbolize.cc',
|
||||||
'third_party/symbolize/demangle.cc',
|
'third_party/symbolize/demangle.cc',
|
||||||
],
|
],
|
||||||
|
'include_dirs': [
|
||||||
|
'..',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'target_name': 'xdg_mime',
|
'target_name': 'xdg_mime',
|
||||||
|
@ -59,7 +59,7 @@ bool SpawnDebuggerOnProcess(unsigned /* process_id */) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX) || defined(OS_OPENBSD)
|
||||||
|
|
||||||
// Based on Apple's recommended method as described in
|
// Based on Apple's recommended method as described in
|
||||||
// http://developer.apple.com/qa/qa2004/qa1361.html
|
// http://developer.apple.com/qa/qa2004/qa1361.html
|
||||||
@ -80,6 +80,10 @@ bool BeingDebugged() {
|
|||||||
KERN_PROC,
|
KERN_PROC,
|
||||||
KERN_PROC_PID,
|
KERN_PROC_PID,
|
||||||
getpid()
|
getpid()
|
||||||
|
#if defined(OS_OPENBSD)
|
||||||
|
, sizeof(struct kinfo_proc),
|
||||||
|
0
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
|
// Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
|
||||||
@ -87,6 +91,13 @@ bool BeingDebugged() {
|
|||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
size_t info_size = sizeof(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);
|
int sysctl_result = sysctl(mib, arraysize(mib), &info, &info_size, NULL, 0);
|
||||||
DCHECK_EQ(sysctl_result, 0);
|
DCHECK_EQ(sysctl_result, 0);
|
||||||
if (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.
|
// This process is being debugged if the P_TRACED flag is set.
|
||||||
is_set = true;
|
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;
|
being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
|
||||||
|
#endif
|
||||||
return being_debugged;
|
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
|
// Android doesn't implement set_new_handler, so we can't use the
|
||||||
// OutOfMemoryTest cases.
|
// 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 {
|
class OutOfMemoryDeathTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
OutOfMemoryDeathTest()
|
OutOfMemoryDeathTest()
|
||||||
|
5
base/third_party/symbolize/symbolize.cc
vendored
5
base/third_party/symbolize/symbolize.cc
vendored
@ -46,6 +46,7 @@
|
|||||||
// and memmove(). We assume they are async-signal-safe.
|
// and memmove(). We assume they are async-signal-safe.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "build/build_config.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
#if defined(HAVE_SYMBOLIZE)
|
#if defined(HAVE_SYMBOLIZE)
|
||||||
@ -95,7 +96,11 @@ _END_GOOGLE_NAMESPACE_
|
|||||||
#if defined(__ELF__)
|
#if defined(__ELF__)
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#if defined(OS_OPENBSD)
|
||||||
|
#include <sys/exec_elf.h>
|
||||||
|
#else
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -260,7 +260,7 @@
|
|||||||
'<!@(<(pkg-config) --libs-only-l gio-2.0)',
|
'<!@(<(pkg-config) --libs-only-l gio-2.0)',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['linux_link_gsettings==0', {
|
['linux_link_gsettings==0 and OS=="linux"', {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
'-ldl',
|
'-ldl',
|
||||||
],
|
],
|
||||||
@ -387,11 +387,15 @@
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'link_settings': {
|
'conditions': [
|
||||||
'libraries': [
|
['OS=="linux"', {
|
||||||
'-ldl',
|
'link_settings': {
|
||||||
],
|
'libraries': [
|
||||||
},
|
'-ldl',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
],
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
|
Reference in New Issue
Block a user