From ee25f6794b63fdb11ca6861cd1e58bc74aaefbce Mon Sep 17 00:00:00 2001 From: "primiano@chromium.org" Date: Tue, 10 Mar 2015 20:09:06 +0000 Subject: [PATCH] Make breakpad compatible with Android NDK r10d. r1397 did introduce a workaround to deal with a typo in sys/user.h in the Android NDK. The typo has been fixed in [1]. However, breakpad cannot just switch to the fixed version as this would require atomic rolls of Breakpad and NDK in chromium, which would make reverts hard to handle. This change introduces an inelegant yet functional hack which makes breakpad compatible with both versions of the NDK, with and without the typo. It can be reverted once Chrome has stably rolled to NDK r10d. [1] https://android.googlesource.com/platform/bionic/+/f485547b BUG=breakpad:642 R=fdegans@chromium.org, rmcilroy@chromium.org Review URL: https://breakpad.appspot.com/7814002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1433 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../linux/dump_writer_common/thread_info.cc | 6 +----- src/client/linux/dump_writer_common/thread_info.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/client/linux/dump_writer_common/thread_info.cc b/src/client/linux/dump_writer_common/thread_info.cc index f8488366..9fe253c6 100644 --- a/src/client/linux/dump_writer_common/thread_info.cc +++ b/src/client/linux/dump_writer_common/thread_info.cc @@ -178,12 +178,8 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const { out->flt_save.data_offset = fpregs.rdp; out->flt_save.data_selector = 0; // We don't have this. out->flt_save.mx_csr = fpregs.mxcsr; -#if defined (__ANDROID__) - // Internal bug b/18097559 - out->flt_save.mx_csr_mask = fpregs.mxcsr_mask; -#else out->flt_save.mx_csr_mask = fpregs.mxcr_mask; -#endif + my_memcpy(&out->flt_save.float_registers, &fpregs.st_space, 8 * 16); my_memcpy(&out->flt_save.xmm_registers, &fpregs.xmm_space, 16 * 16); } diff --git a/src/client/linux/dump_writer_common/thread_info.h b/src/client/linux/dump_writer_common/thread_info.h index 5f24fd6b..2a99bb97 100644 --- a/src/client/linux/dump_writer_common/thread_info.h +++ b/src/client/linux/dump_writer_common/thread_info.h @@ -31,7 +31,22 @@ #define CLIENT_LINUX_DUMP_WRITER_COMMON_THREAD_INFO_H_ #include + +// TODO(primiano): remove this after Chromium has stably rolled to NDK r10d. +// Historical context: NDK releases < r10d had a typo in sys/user.h (mxcsr_mask +// instead of mxcr_mask), which is fixed in r10d. However, just switching to use +// the correct one (mxcr_mask) would put Breakpad in a state where it can be +// rolled in chromium only atomically with the r10d NDK. A revert of either +// project (android_tools, breakpad) would make the other one unrollable. +// This hack makes breakpad code compatible with both r10c and r10d NDKs, +// reducing the dependency entangling with android_tools. +#if defined (__ANDROID__) +#define mxcsr_mask mxcr_mask #include +#undef mxcsr_mask +#else +#include +#endif #include "client/linux/dump_writer_common/raw_context_cpu.h" #include "common/memory.h"