2014-07-31 13:45:51 -04:00
|
|
|
# Copyright 2014 The Crashpad Authors. All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
{
|
2015-03-08 15:17:22 -04:00
|
|
|
'includes': [
|
|
|
|
'../build/crashpad.gypi',
|
|
|
|
],
|
2014-07-31 13:45:51 -04:00
|
|
|
'targets': [
|
|
|
|
{
|
2015-03-08 16:25:34 -04:00
|
|
|
'target_name': 'crashpad_compat',
|
2014-09-12 12:13:27 -04:00
|
|
|
'type': 'static_library',
|
2014-07-31 13:45:51 -04:00
|
|
|
'sources': [
|
2017-12-22 15:32:37 -08:00
|
|
|
'android/dlfcn_internal.cc',
|
|
|
|
'android/dlfcn_internal.h',
|
2017-10-06 12:47:28 -04:00
|
|
|
'android/elf.h',
|
|
|
|
'android/linux/elf.h',
|
|
|
|
'android/linux/prctl.h',
|
|
|
|
'android/linux/ptrace.h',
|
|
|
|
'android/sched.h',
|
2017-12-19 12:03:54 -08:00
|
|
|
'android/sys/epoll.cc',
|
|
|
|
'android/sys/epoll.h',
|
2017-12-06 12:53:54 -05:00
|
|
|
'android/sys/mman.cc',
|
|
|
|
'android/sys/mman.h',
|
2017-10-06 12:47:28 -04:00
|
|
|
'android/sys/syscall.h',
|
|
|
|
'android/sys/user.h',
|
|
|
|
'linux/signal.h',
|
|
|
|
'linux/sys/ptrace.h',
|
2014-07-31 13:45:51 -04:00
|
|
|
'mac/AvailabilityMacros.h',
|
2015-12-02 15:31:44 -08:00
|
|
|
'mac/kern/exc_resource.h',
|
2017-06-20 09:50:37 -04:00
|
|
|
'mac/mach/i386/thread_state.h',
|
2014-07-31 13:45:51 -04:00
|
|
|
'mac/mach/mach.h',
|
|
|
|
'mac/mach-o/loader.h',
|
2015-04-08 17:46:09 -04:00
|
|
|
'mac/sys/resource.h',
|
2014-08-01 14:37:20 -04:00
|
|
|
'non_mac/mach/mach.h',
|
2014-07-31 13:45:51 -04:00
|
|
|
'non_win/dbghelp.h',
|
|
|
|
'non_win/minwinbase.h',
|
|
|
|
'non_win/timezoneapi.h',
|
|
|
|
'non_win/verrsrc.h',
|
2015-02-04 17:30:03 -08:00
|
|
|
'non_win/windows.h',
|
2014-07-31 13:45:51 -04:00
|
|
|
'non_win/winnt.h',
|
2015-05-06 10:28:07 -07:00
|
|
|
'win/getopt.h',
|
2015-08-05 16:34:50 -04:00
|
|
|
'win/strings.cc',
|
|
|
|
'win/strings.h',
|
2017-10-06 12:47:28 -04:00
|
|
|
'win/sys/time.h',
|
2014-12-10 11:39:50 -08:00
|
|
|
'win/sys/types.h',
|
2015-05-06 10:28:07 -07:00
|
|
|
'win/time.cc',
|
|
|
|
'win/time.h',
|
2017-10-26 18:37:49 -04:00
|
|
|
'win/winbase.h',
|
2015-03-02 13:06:34 -08:00
|
|
|
'win/winnt.h',
|
2017-10-11 00:19:13 -04:00
|
|
|
'win/winternl.h',
|
2014-07-31 13:45:51 -04:00
|
|
|
],
|
2014-09-12 12:13:27 -04:00
|
|
|
'conditions': [
|
|
|
|
['OS=="mac"', {
|
|
|
|
'include_dirs': [
|
|
|
|
'mac',
|
|
|
|
],
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'include_dirs': [
|
|
|
|
'mac',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}],
|
2014-12-10 11:39:50 -08:00
|
|
|
['OS=="win"', {
|
|
|
|
'include_dirs': [
|
|
|
|
'win',
|
|
|
|
],
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'include_dirs': [
|
|
|
|
'win',
|
|
|
|
],
|
|
|
|
},
|
2015-05-06 10:28:07 -07:00
|
|
|
'dependencies': [
|
|
|
|
'../third_party/getopt/getopt.gyp:getopt',
|
|
|
|
],
|
2014-12-10 11:39:50 -08:00
|
|
|
}, {
|
2014-09-12 12:13:27 -04:00
|
|
|
'include_dirs': [
|
|
|
|
'non_win',
|
|
|
|
],
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'include_dirs': [
|
|
|
|
'non_win',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}],
|
2017-03-15 13:47:31 -04:00
|
|
|
['OS=="android"', {
|
|
|
|
'include_dirs': [
|
|
|
|
'android',
|
2017-08-01 19:05:06 -07:00
|
|
|
'linux',
|
2017-03-15 13:47:31 -04:00
|
|
|
],
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'include_dirs': [
|
|
|
|
'android',
|
2017-08-01 19:05:06 -07:00
|
|
|
'linux',
|
2017-03-15 13:47:31 -04:00
|
|
|
],
|
|
|
|
},
|
android: Support mmap() with large file offsets and API < 21
Chrome (and therefore mini_chromium) has always built with
_FILE_OFFSET_BITS=64, which is intended to enable a 64-bit off_t even
for 32-bit programs. However, support was never present in Android with
NDK traditional headers.
The new NDK unified headers do recognize _FILE_OFFSET_BITS=64 and enable
a 64-bit off_t, along with corresponding functions and system call
wrappers. However, no mmap() wrapper supporting a 64-bit off_t for
32-bit programs was available prior to API 21 (Android 5.0 “Lollipop”),
so when targeting older API levels, NDK headers do not proivde an mmap()
declaration. This avoids silently truncating 64-bit off_t values to 32
bits. NDK r15b did make such an mmap() wrapper available
(https://android.googlesource.com/platform/bionic/+/785b249df024), and
it did silently truncate, but this was removed for r15c
(https://android.googlesource.com/platform/bionic/+/00fedf587917).
How should this work if _FILE_OFFSET_BITS is set to 64 and recent
unified headers are in use?
The strategy employed here is to provide an mmap() declaration in
compat, with a 64-bit off_t. That mmap() will call to Bionic’s mmap64()
wrapper if available (it’s available since Android 5.0 “Lollipop”). If
unavailable, it implements the same logic that mmap64() does directly,
which predominantly involves calling the __mmap2() system call. Bionic
has always provided wrappers for __mmap2().
Additional reading:
https://android.googlesource.com/platform/bionic/+/0bfcbaf4d069/docs/32-bit-abi.md#is-32_bit-1
https://github.com/android-ndk/ndk/issues/442
Bug: crashpad:30
Change-Id: I98c10e2eda773cb6f3d9eb8db9b8bfde43c885e7
Reviewed-on: https://chromium-review.googlesource.com/705674
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-10-06 15:58:36 -04:00
|
|
|
'link_settings': {
|
|
|
|
'libraries': [
|
|
|
|
'-ldl',
|
|
|
|
],
|
|
|
|
},
|
2017-03-15 13:47:31 -04:00
|
|
|
}],
|
linux: Use PTRACE_GET_THREAD_AREA for x86 ThreadInfo.GetThreadArea
Linux supports TLS on x86 by allocating slots in the GDT, accessible
via the system calls get/set_thread_area. This allows segment
registers (%gs on x86) to be used to quickly access the TLS.
Previously, we used PTRACE_GETREGSET with the NT_386_TLS regset. This
"register set" provides access to the subarray of the GDT used for TLS.
However, there are multiple slots provided and we don't know which one
is being used by the threading library for the current thread's TLS.
Previously, we were just using the first one, which worked for x86 on
64-bit kernels, but not 32-bit kernels. On 32-bit kernels, the first
slot ended up pointing to the TLS of the main thread.
The authoritative index of the current thread's TLS in the GDT is
given by bits 3-15 of %gs. However, this index cannot be used with
PTRACE_GETREGSET+NT386_TLS because we don't know the location of the
TLS slots in the GDT. PTRACE_GET_THREAD_AREA, however, accepts an
index from the start of the GDT similarly to get/set_thread_area.
Bug: crashpad:30
Change-Id: Ie6dfbdd088c6816fad409812a1a97037d4b38fd7
Reviewed-on: https://chromium-review.googlesource.com/575318
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-07-18 16:42:58 -07:00
|
|
|
['OS=="linux"', {
|
|
|
|
'include_dirs': [
|
|
|
|
'linux',
|
|
|
|
],
|
|
|
|
'direct_dependent_settings': {
|
|
|
|
'include_dirs': [
|
|
|
|
'linux',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}],
|
2014-09-12 12:13:27 -04:00
|
|
|
],
|
2014-07-31 13:45:51 -04:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|