aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ios/exception_handler_no_mach.cc4
-rw-r--r--src/client/linux/crash_generation/crash_generation_client.cc12
-rw-r--r--src/client/linux/crash_generation/crash_generation_client.h11
-rw-r--r--src/client/linux/crash_generation/crash_generation_server.cc4
-rw-r--r--src/client/linux/dump_writer_common/thread_info.cc34
-rw-r--r--src/client/linux/dump_writer_common/ucontext_reader.cc32
-rw-r--r--src/client/linux/handler/exception_handler.cc4
-rw-r--r--src/client/linux/handler/exception_handler_unittest.cc4
-rw-r--r--src/client/linux/handler/minidump_descriptor.cc4
-rw-r--r--src/client/linux/log/log.cc4
-rw-r--r--src/client/linux/microdump_writer/microdump_writer.cc4
-rw-r--r--src/client/linux/microdump_writer/microdump_writer_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/cpu_set_unittest.cc64
-rw-r--r--src/client/linux/minidump_writer/directory_reader_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/line_reader_unittest.cc45
-rw-r--r--src/client/linux/minidump_writer/linux_core_dumper.cc4
-rw-r--r--src/client/linux/minidump_writer/linux_core_dumper_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/linux_dumper.cc8
-rw-r--r--src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc4
-rw-r--r--src/client/linux/minidump_writer/linux_ptrace_dumper.cc12
-rw-r--r--src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/minidump_writer.cc4
-rw-r--r--src/client/linux/minidump_writer/minidump_writer_unittest.cc4
-rw-r--r--src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc4
-rw-r--r--src/client/linux/minidump_writer/pe_file.cc4
-rw-r--r--src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc60
-rw-r--r--src/client/linux/sender/google_crash_report_sender.cc4
-rw-r--r--src/client/mac/crash_generation/crash_generation_client.cc4
-rw-r--r--src/client/mac/crash_generation/crash_generation_server.cc4
-rw-r--r--src/client/mac/handler/breakpad_nlist_64.cc4
-rw-r--r--src/client/mac/handler/dynamic_images.cc4
-rw-r--r--src/client/mac/handler/exception_handler.cc4
-rw-r--r--src/client/mac/handler/minidump_generator.cc4
-rw-r--r--src/client/mac/handler/protected_memory_allocator.cc4
-rw-r--r--src/client/mac/handler/testcases/DynamicImagesTests.cc4
-rw-r--r--src/client/mac/handler/testcases/breakpad_nlist_test.cc4
-rw-r--r--src/client/mac/tests/crash_generation_server_test.cc4
-rw-r--r--src/client/mac/tests/exception_handler_test.cc4
-rw-r--r--src/client/mac/tests/minidump_generator_test.cc4
-rw-r--r--src/client/mac/tests/minidump_generator_test_helper.cc4
-rw-r--r--src/client/minidump_file_writer.cc4
-rw-r--r--src/client/minidump_file_writer_unittest.cc4
-rw-r--r--src/client/solaris/handler/exception_handler.cc4
-rw-r--r--src/client/solaris/handler/exception_handler_test.cc4
-rw-r--r--src/client/solaris/handler/minidump_generator.cc4
-rw-r--r--src/client/solaris/handler/minidump_test.cc4
-rw-r--r--src/client/solaris/handler/solaris_lwp.cc4
-rw-r--r--src/client/windows/crash_generation/client_info.cc4
-rw-r--r--src/client/windows/crash_generation/crash_generation_client.cc4
-rw-r--r--src/client/windows/crash_generation/crash_generation_server.cc4
-rw-r--r--src/client/windows/crash_generation/minidump_generator.cc4
-rw-r--r--src/client/windows/handler/exception_handler.cc4
-rw-r--r--src/client/windows/sender/crash_report_sender.cc4
-rw-r--r--src/client/windows/tests/crash_generation_app/abstract_class.cc4
-rw-r--r--src/client/windows/tests/crash_generation_app/crash_generation_app.cc4
-rw-r--r--src/client/windows/unittests/crash_generation_server_test.cc4
-rw-r--r--src/client/windows/unittests/dump_analysis.cc4
-rw-r--r--src/client/windows/unittests/exception_handler_death_test.cc4
-rw-r--r--src/client/windows/unittests/exception_handler_nesting_test.cc4
-rw-r--r--src/client/windows/unittests/exception_handler_test.cc4
-rw-r--r--src/client/windows/unittests/minidump_test.cc4
61 files changed, 348 insertions, 138 deletions
diff --git a/src/client/ios/exception_handler_no_mach.cc b/src/client/ios/exception_handler_no_mach.cc
index 6bb41021..0b2182ea 100644
--- a/src/client/ios/exception_handler_no_mach.cc
+++ b/src/client/ios/exception_handler_no_mach.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <signal.h>
#include <TargetConditionals.h>
diff --git a/src/client/linux/crash_generation/crash_generation_client.cc b/src/client/linux/crash_generation/crash_generation_client.cc
index 5a8c6b4c..020c6146 100644
--- a/src/client/linux/crash_generation/crash_generation_client.cc
+++ b/src/client/linux/crash_generation/crash_generation_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/crash_generation/crash_generation_client.h"
#include <stdio.h>
@@ -45,9 +49,11 @@ namespace {
class CrashGenerationClientImpl : public CrashGenerationClient {
public:
explicit CrashGenerationClientImpl(int server_fd) : server_fd_(server_fd) {}
- virtual ~CrashGenerationClientImpl() {}
+ CrashGenerationClientImpl(const CrashGenerationClientImpl&) = delete;
+ void operator=(const CrashGenerationClientImpl&) = delete;
+ ~CrashGenerationClientImpl() override = default;
- virtual bool RequestDump(const void* blob, size_t blob_size) {
+ bool RequestDump(const void* blob, size_t blob_size) override {
int fds[2];
if (sys_pipe(fds) < 0)
return false;
@@ -88,8 +94,6 @@ class CrashGenerationClientImpl : public CrashGenerationClient {
private:
int server_fd_;
-
- DISALLOW_COPY_AND_ASSIGN(CrashGenerationClientImpl);
};
} // namespace
diff --git a/src/client/linux/crash_generation/crash_generation_client.h b/src/client/linux/crash_generation/crash_generation_client.h
index 915b5700..1e4a7a5e 100644
--- a/src/client/linux/crash_generation/crash_generation_client.h
+++ b/src/client/linux/crash_generation/crash_generation_client.h
@@ -29,8 +29,6 @@
#ifndef CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
#define CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
-#include "common/basictypes.h"
-
#include <stddef.h>
namespace google_breakpad {
@@ -41,8 +39,10 @@ namespace google_breakpad {
// via a remote process.
class CrashGenerationClient {
public:
- CrashGenerationClient() {}
- virtual ~CrashGenerationClient() {}
+ CrashGenerationClient() = default;
+ CrashGenerationClient(const CrashGenerationClient&) = delete;
+ void operator=(const CrashGenerationClient&) = delete;
+ virtual ~CrashGenerationClient() = default;
// Request the crash server to generate a dump. |blob| is an opaque
// CrashContext pointer from exception_handler.h.
@@ -54,9 +54,6 @@ class CrashGenerationClient {
// The returned CrashGenerationClient* is owned by the caller of
// this function.
static CrashGenerationClient* TryCreate(int server_fd);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CrashGenerationClient);
};
} // namespace google_breakpad
diff --git a/src/client/linux/crash_generation/crash_generation_server.cc b/src/client/linux/crash_generation/crash_generation_server.cc
index 56cc0cd7..e3270c9d 100644
--- a/src/client/linux/crash_generation/crash_generation_server.cc
+++ b/src/client/linux/crash_generation/crash_generation_server.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <assert.h>
#include <dirent.h>
#include <fcntl.h>
diff --git a/src/client/linux/dump_writer_common/thread_info.cc b/src/client/linux/dump_writer_common/thread_info.cc
index d8bf80b0..6288a056 100644
--- a/src/client/linux/dump_writer_common/thread_info.cc
+++ b/src/client/linux/dump_writer_common/thread_info.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/dump_writer_common/thread_info.h"
#include <string.h>
@@ -318,23 +322,19 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
out->t5 = mcontext.__gregs[30];
out->t6 = mcontext.__gregs[31];
-# if __riscv_flen == 32
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = mcontext.__fpregs.__f.__f[i];
- out->float_save.fpcsr = mcontext.__fpregs.__f.__fcsr;
-# elif __riscv_flen == 64
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = mcontext.__fpregs.__d.__f[i];
- out->float_save.fpcsr = mcontext.__fpregs.__d.__fcsr;
-# elif __riscv_flen == 128
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++) {
- out->float_save.regs[i].high = mcontext.__fpregs.__q.__f[2*i];
- out->float_save.regs[i].low = mcontext.__fpregs.__q.__f[2*i+1];
- }
- out->float_save.fpcsr = mcontext.__fpregs.__q.__fcsr;
-# else
-# error "Unexpected __riscv_flen"
-# endif
+ // Breakpad only supports RISCV32 with 32 bit floating point.
+ // Breakpad only supports RISCV64 with 64 bit floating point.
+#if __riscv_xlen == 32
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = mcontext.__fpregs.__f.__f[i];
+ out->fcsr = mcontext.__fpregs.__f.__fcsr;
+#elif __riscv_xlen == 64
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = mcontext.__fpregs.__d.__f[i];
+ out->fcsr = mcontext.__fpregs.__d.__fcsr;
+#else
+#error "Unexpected __riscv_xlen"
+#endif
}
#endif // __riscv
diff --git a/src/client/linux/dump_writer_common/ucontext_reader.cc b/src/client/linux/dump_writer_common/ucontext_reader.cc
index 97ed2a9f..76497683 100644
--- a/src/client/linux/dump_writer_common/ucontext_reader.cc
+++ b/src/client/linux/dump_writer_common/ucontext_reader.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/dump_writer_common/ucontext_reader.h"
#include "common/linux/linux_libc_support.h"
@@ -306,21 +310,19 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
out->t5 = uc->uc_mcontext.__gregs[30];
out->t6 = uc->uc_mcontext.__gregs[31];
-# if __riscv_flen == 32
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = uc->uc_mcontext.__fpregs.__f.__f[i];
- out->float_save.fpcsr = uc->uc_mcontext.__fpregs.__f.__fcsr;
-# elif __riscv_flen == 64
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++)
- out->float_save.regs[i] = uc->uc_mcontext.__fpregs.__d.__f[i];
- out->float_save.fpcsr = uc->uc_mcontext.__fpregs.__d.__fcsr;
-# elif __riscv_flen == 128
- for(int i = 0; i < MD_FLOATINGSAVEAREA_RISCV_FPR_COUNT; i++) {
- out->float_save.regs[i].high = uc->uc_mcontext.__fpregs.__q.__f[2*i];
- out->float_save.regs[i].low = uc->uc_mcontext.__fpregs.__q.__f[2*i+1];
- }
- out->float_save.fpcsr = uc->uc_mcontext.__fpregs.__q.__fcsr;
-# endif
+ // Breakpad only supports RISCV32 with 32 bit floating point.
+ // Breakpad only supports RISCV64 with 64 bit floating point.
+#if __riscv_xlen == 32
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = uc->uc_mcontext.__fpregs.__f.__f[i];
+ out->fcsr = uc->uc_mcontext.__fpregs.__f.__fcsr;
+#elif __riscv_xlen == 64
+ for (int i = 0; i < MD_CONTEXT_RISCV_FPR_COUNT; i++)
+ out->fpregs[i] = uc->uc_mcontext.__fpregs.__d.__f[i];
+ out->fcsr = uc->uc_mcontext.__fpregs.__d.__fcsr;
+#else
+#error "Unexpected __riscv_xlen"
+#endif
}
#endif
diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
index bbdb798b..9e23c119 100644
--- a/src/client/linux/handler/exception_handler.cc
+++ b/src/client/linux/handler/exception_handler.cc
@@ -62,6 +62,10 @@
// alternative malloc. Each function should have comment above it detailing the
// context which it runs in.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/handler/exception_handler.h"
#include <errno.h>
diff --git a/src/client/linux/handler/exception_handler_unittest.cc b/src/client/linux/handler/exception_handler_unittest.cc
index 691ea133..b2d8d468 100644
--- a/src/client/linux/handler/exception_handler_unittest.cc
+++ b/src/client/linux/handler/exception_handler_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <poll.h>
#include <pthread.h>
#include <stdint.h>
diff --git a/src/client/linux/handler/minidump_descriptor.cc b/src/client/linux/handler/minidump_descriptor.cc
index 517fce97..db2f9b18 100644
--- a/src/client/linux/handler/minidump_descriptor.cc
+++ b/src/client/linux/handler/minidump_descriptor.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdio.h>
#include "client/linux/handler/minidump_descriptor.h"
diff --git a/src/client/linux/log/log.cc b/src/client/linux/log/log.cc
index c45de64b..2a48d7fe 100644
--- a/src/client/linux/log/log.cc
+++ b/src/client/linux/log/log.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/log/log.h"
#if defined(__ANDROID__)
diff --git a/src/client/linux/microdump_writer/microdump_writer.cc b/src/client/linux/microdump_writer/microdump_writer.cc
index 1f19d3bb..93dae35e 100644
--- a/src/client/linux/microdump_writer/microdump_writer.cc
+++ b/src/client/linux/microdump_writer/microdump_writer.cc
@@ -29,6 +29,10 @@
// This translation unit generates microdumps into the console (logcat on
// Android). See crbug.com/410294 for more info and design docs.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/microdump_writer/microdump_writer.h"
#include <limits>
diff --git a/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/src/client/linux/microdump_writer/microdump_writer_unittest.cc
index 84865664..b1d570eb 100644
--- a/src/client/linux/microdump_writer/microdump_writer_unittest.cc
+++ b/src/client/linux/microdump_writer/microdump_writer_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <ctype.h>
#include <sys/syscall.h>
#include <sys/types.h>
diff --git a/src/client/linux/minidump_writer/cpu_set_unittest.cc b/src/client/linux/minidump_writer/cpu_set_unittest.cc
index 1db74410..b99e98de 100644
--- a/src/client/linux/minidump_writer/cpu_set_unittest.cc
+++ b/src/client/linux/minidump_writer/cpu_set_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -35,7 +39,7 @@
#include "breakpad_googletest_includes.h"
#include "client/linux/minidump_writer/cpu_set.h"
-#include "common/linux/tests/auto_testfile.h"
+#include "common/linux/scoped_tmpfile.h"
using namespace google_breakpad;
@@ -43,15 +47,6 @@ namespace {
typedef testing::Test CpuSetTest;
-// Helper class to write test text file to a temporary file and return
-// its file descriptor.
-class ScopedTestFile : public AutoTestFile {
-public:
- explicit ScopedTestFile(const char* text)
- : AutoTestFile("cpu_set", text) {
- }
-};
-
}
TEST(CpuSetTest, EmptyCount) {
@@ -60,8 +55,8 @@ TEST(CpuSetTest, EmptyCount) {
}
TEST(CpuSetTest, OneCpu) {
- ScopedTestFile file("10");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("10"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -69,8 +64,8 @@ TEST(CpuSetTest, OneCpu) {
}
TEST(CpuSetTest, OneCpuTerminated) {
- ScopedTestFile file("10\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("10\n"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -78,8 +73,8 @@ TEST(CpuSetTest, OneCpuTerminated) {
}
TEST(CpuSetTest, TwoCpusWithComma) {
- ScopedTestFile file("1,10");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("1,10"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -87,8 +82,8 @@ TEST(CpuSetTest, TwoCpusWithComma) {
}
TEST(CpuSetTest, TwoCpusWithRange) {
- ScopedTestFile file("1-2");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("1-2"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -96,8 +91,8 @@ TEST(CpuSetTest, TwoCpusWithRange) {
}
TEST(CpuSetTest, TenCpusWithRange) {
- ScopedTestFile file("9-18");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("9-18"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -105,8 +100,8 @@ TEST(CpuSetTest, TenCpusWithRange) {
}
TEST(CpuSetTest, MultiItems) {
- ScopedTestFile file("0, 2-4, 128");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("0, 2-4, 128"));
CpuSet set;
ASSERT_TRUE(set.ParseSysFile(file.GetFd()));
@@ -114,14 +109,16 @@ TEST(CpuSetTest, MultiItems) {
}
TEST(CpuSetTest, IntersectWith) {
- ScopedTestFile file1("9-19");
- ASSERT_TRUE(file1.IsOk());
+ ScopedTmpFile file1;
+ ASSERT_TRUE(file1.InitString("9-19"));
+
CpuSet set1;
ASSERT_TRUE(set1.ParseSysFile(file1.GetFd()));
ASSERT_EQ(11, set1.GetCount());
- ScopedTestFile file2("16-24");
- ASSERT_TRUE(file2.IsOk());
+ ScopedTmpFile file2;
+ ASSERT_TRUE(file2.InitString("16-24"));
+
CpuSet set2;
ASSERT_TRUE(set2.ParseSysFile(file2.GetFd()));
ASSERT_EQ(9, set2.GetCount());
@@ -132,8 +129,9 @@ TEST(CpuSetTest, IntersectWith) {
}
TEST(CpuSetTest, SelfIntersection) {
- ScopedTestFile file1("9-19");
- ASSERT_TRUE(file1.IsOk());
+ ScopedTmpFile file1;
+ ASSERT_TRUE(file1.InitString("9-19"));
+
CpuSet set1;
ASSERT_TRUE(set1.ParseSysFile(file1.GetFd()));
ASSERT_EQ(11, set1.GetCount());
@@ -143,14 +141,16 @@ TEST(CpuSetTest, SelfIntersection) {
}
TEST(CpuSetTest, EmptyIntersection) {
- ScopedTestFile file1("0-19");
- ASSERT_TRUE(file1.IsOk());
+ ScopedTmpFile file1;
+ ASSERT_TRUE(file1.InitString("0-19"));
+
CpuSet set1;
ASSERT_TRUE(set1.ParseSysFile(file1.GetFd()));
ASSERT_EQ(20, set1.GetCount());
- ScopedTestFile file2("20-39");
- ASSERT_TRUE(file2.IsOk());
+ ScopedTmpFile file2;
+ ASSERT_TRUE(file2.InitString("20-39"));
+
CpuSet set2;
ASSERT_TRUE(set2.ParseSysFile(file2.GetFd()));
ASSERT_EQ(20, set2.GetCount());
diff --git a/src/client/linux/minidump_writer/directory_reader_unittest.cc b/src/client/linux/minidump_writer/directory_reader_unittest.cc
index ffc5fbfd..708d586e 100644
--- a/src/client/linux/minidump_writer/directory_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/directory_reader_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <set>
#include <string>
diff --git a/src/client/linux/minidump_writer/line_reader_unittest.cc b/src/client/linux/minidump_writer/line_reader_unittest.cc
index 3062c39f..bc1f9d39 100644
--- a/src/client/linux/minidump_writer/line_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/line_reader_unittest.cc
@@ -26,13 +26,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include "client/linux/minidump_writer/line_reader.h"
#include "breakpad_googletest_includes.h"
-#include "common/linux/tests/auto_testfile.h"
+#include "common/linux/scoped_tmpfile.h"
using namespace google_breakpad;
@@ -40,22 +44,11 @@ namespace {
typedef testing::Test LineReaderTest;
-class ScopedTestFile : public AutoTestFile {
-public:
- explicit ScopedTestFile(const char* text)
- : AutoTestFile("line_reader", text) {
- }
-
- ScopedTestFile(const char* text, size_t text_len)
- : AutoTestFile("line_reader", text, text_len) {
- }
-};
-
}
TEST(LineReaderTest, EmptyFile) {
- ScopedTestFile file("");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString(""));
LineReader reader(file.GetFd());
const char* line;
@@ -64,8 +57,8 @@ TEST(LineReaderTest, EmptyFile) {
}
TEST(LineReaderTest, OneLineTerminated) {
- ScopedTestFile file("a\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a\n"));
LineReader reader(file.GetFd());
const char* line;
@@ -80,8 +73,8 @@ TEST(LineReaderTest, OneLineTerminated) {
}
TEST(LineReaderTest, OneLine) {
- ScopedTestFile file("a");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a"));
LineReader reader(file.GetFd());
const char* line;
@@ -96,8 +89,8 @@ TEST(LineReaderTest, OneLine) {
}
TEST(LineReaderTest, TwoLinesTerminated) {
- ScopedTestFile file("a\nb\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a\nb\n"));
LineReader reader(file.GetFd());
const char* line;
@@ -118,8 +111,8 @@ TEST(LineReaderTest, TwoLinesTerminated) {
}
TEST(LineReaderTest, TwoLines) {
- ScopedTestFile file("a\nb");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("a\nb"));
LineReader reader(file.GetFd());
const char* line;
@@ -142,8 +135,8 @@ TEST(LineReaderTest, TwoLines) {
TEST(LineReaderTest, MaxLength) {
char l[LineReader::kMaxLineLen-1];
memset(l, 'a', sizeof(l));
- ScopedTestFile file(l, sizeof(l));
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitData(l, sizeof(l)));
LineReader reader(file.GetFd());
const char* line;
@@ -158,8 +151,8 @@ TEST(LineReaderTest, TooLong) {
// Note: this writes kMaxLineLen 'a' chars in the test file.
char l[LineReader::kMaxLineLen];
memset(l, 'a', sizeof(l));
- ScopedTestFile file(l, sizeof(l));
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitData(l, sizeof(l)));
LineReader reader(file.GetFd());
const char* line;
diff --git a/src/client/linux/minidump_writer/linux_core_dumper.cc b/src/client/linux/minidump_writer/linux_core_dumper.cc
index 2c507c1b..4bf9094e 100644
--- a/src/client/linux/minidump_writer/linux_core_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_core_dumper.cc
@@ -29,6 +29,10 @@
// linux_core_dumper.cc: Implement google_breakpad::LinuxCoreDumper.
// See linux_core_dumper.h for details.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/minidump_writer/linux_core_dumper.h"
#include <asm/ptrace.h>
diff --git a/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
index 157e4f89..72790422 100644
--- a/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
+++ b/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc
@@ -29,6 +29,10 @@
// linux_core_dumper_unittest.cc:
// Unit tests for google_breakpad::LinuxCoreDumoer.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string>
#include "breakpad_googletest_includes.h"
diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc
index 01b06fac..5c4c389c 100644
--- a/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper.cc
@@ -34,6 +34,10 @@
// rules apply as detailed at the top of minidump_writer.h: no libc calls and
// use the alternative allocator.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/minidump_writer/linux_dumper.h"
#include <assert.h>
@@ -342,7 +346,7 @@ LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
return false;
bool filename_modified = HandleDeletedFileInMapping(filename);
- MemoryMappedFile mapped_file(filename, mapping.offset);
+ MemoryMappedFile mapped_file(filename, 0);
if (!mapped_file.data() || mapped_file.size() < SELFMAG)
return false;
@@ -455,7 +459,7 @@ bool ElfFileSoName(const LinuxDumper& dumper,
if (!dumper.GetMappingAbsolutePath(mapping, filename))
return false;
- MemoryMappedFile mapped_file(filename, mapping.offset);
+ MemoryMappedFile mapped_file(filename, 0);
if (!mapped_file.data() || mapped_file.size() < SELFMAG) {
// mmap failed
return false;
diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
index bc1e4fbe..5a135fda 100644
--- a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
@@ -30,6 +30,10 @@
// threads. The first word of each thread's stack is set to the thread
// id.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
index 718fab7c..2adc39e1 100644
--- a/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
@@ -35,6 +35,10 @@
// rules apply as detailed at the top of minidump_writer.h: no libc calls and
// use the alternative allocator.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/minidump_writer/linux_ptrace_dumper.h"
#include <asm/ptrace.h>
@@ -175,6 +179,13 @@ bool LinuxPtraceDumper::ReadRegisters(ThreadInfo* info, pid_t tid) {
return false;
}
+ // When running on arm processors the binary may be built with softfp or
+ // hardfp. If built with softfp we have no hardware registers to read from,
+ // so the following read will always fail. gcc defines __SOFTFP__ macro,
+ // clang13 does not do so. see: https://reviews.llvm.org/D135680.
+ // If you are using clang and the macro is NOT defined, please include the
+ // macro define for applicable targets.
+#if !defined(__SOFTFP__)
#if !(defined(__ANDROID__) && defined(__ARM_EABI__))
// When running an arm build on an arm64 device, attempting to get the
// floating point registers fails. On Android, the floating point registers
@@ -186,6 +197,7 @@ bool LinuxPtraceDumper::ReadRegisters(ThreadInfo* info, pid_t tid) {
return false;
}
#endif // !(defined(__ANDROID__) && defined(__ARM_EABI__))
+#endif // !defined(__SOFTFP__)
return true;
#else // PTRACE_GETREGS
return false;
diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
index a8455165..16a9daf1 100644
--- a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
+++ b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
@@ -32,6 +32,10 @@
// This file was renamed from linux_dumper_unittest.cc and modified due
// to LinuxDumper being splitted into two classes.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc
index a5f9b841..a95dd254 100644
--- a/src/client/linux/minidump_writer/minidump_writer.cc
+++ b/src/client/linux/minidump_writer/minidump_writer.cc
@@ -42,6 +42,10 @@
// a canonical instance in the LinuxDumper object. We use the placement
// new form to allocate objects and we don't delete them.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/linux/handler/minidump_descriptor.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include "client/minidump_file_writer-inl.h"
diff --git a/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/src/client/linux/minidump_writer/minidump_writer_unittest.cc
index 2601d29b..effedc5e 100644
--- a/src/client/linux/minidump_writer/minidump_writer_unittest.cc
+++ b/src/client/linux/minidump_writer/minidump_writer_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <poll.h>
#include <sys/stat.h>
diff --git a/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc b/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc
index 92cae92e..399f1a12 100644
--- a/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc
+++ b/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc
@@ -29,6 +29,10 @@
// minidump_writer_unittest_utils.cc:
// Shared routines used by unittests under client/linux/minidump_writer.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <limits.h>
#include <stdlib.h>
diff --git a/src/client/linux/minidump_writer/pe_file.cc b/src/client/linux/minidump_writer/pe_file.cc
index 960b978b..7b3fe6c0 100644
--- a/src/client/linux/minidump_writer/pe_file.cc
+++ b/src/client/linux/minidump_writer/pe_file.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <string.h>
#include "client/linux/minidump_writer/pe_file.h"
diff --git a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
index f6d3e285..4ac52569 100644
--- a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
+++ b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@@ -35,33 +39,19 @@
#include "client/linux/minidump_writer/proc_cpuinfo_reader.h"
#include "breakpad_googletest_includes.h"
-#include "common/linux/tests/auto_testfile.h"
+#include "common/linux/scoped_tmpfile.h"
using namespace google_breakpad;
-#if !defined(__ANDROID__)
-#define TEMPDIR "/tmp"
-#else
-#define TEMPDIR "/data/local/tmp"
-#endif
-
-
namespace {
typedef testing::Test ProcCpuInfoReaderTest;
-class ScopedTestFile : public AutoTestFile {
-public:
- explicit ScopedTestFile(const char* text)
- : AutoTestFile("proc_cpuinfo_reader", text) {
- }
-};
-
}
TEST(ProcCpuInfoReaderTest, EmptyFile) {
- ScopedTestFile file("");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString(""));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -69,8 +59,8 @@ TEST(ProcCpuInfoReaderTest, EmptyFile) {
}
TEST(ProcCpuInfoReaderTest, OneLineTerminated) {
- ScopedTestFile file("foo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -82,8 +72,8 @@ TEST(ProcCpuInfoReaderTest, OneLineTerminated) {
}
TEST(ProcCpuInfoReaderTest, OneLine) {
- ScopedTestFile file("foo : bar");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -97,8 +87,8 @@ TEST(ProcCpuInfoReaderTest, OneLine) {
}
TEST(ProcCpuInfoReaderTest, TwoLinesTerminated) {
- ScopedTestFile file("foo : bar\nzoo : tut\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar\nzoo : tut\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -114,8 +104,8 @@ TEST(ProcCpuInfoReaderTest, TwoLinesTerminated) {
}
TEST(ProcCpuInfoReaderTest, SkipMalformedLine) {
- ScopedTestFile file("this line should have a column\nfoo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("this line should have a column\nfoo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -127,8 +117,8 @@ TEST(ProcCpuInfoReaderTest, SkipMalformedLine) {
}
TEST(ProcCpuInfoReaderTest, SkipOneEmptyLine) {
- ScopedTestFile file("\n\nfoo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("\n\nfoo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -140,8 +130,8 @@ TEST(ProcCpuInfoReaderTest, SkipOneEmptyLine) {
}
TEST(ProcCpuInfoReaderTest, SkipEmptyField) {
- ScopedTestFile file(" : bar\nzoo : tut\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString(" : bar\nzoo : tut\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -153,8 +143,8 @@ TEST(ProcCpuInfoReaderTest, SkipEmptyField) {
}
TEST(ProcCpuInfoReaderTest, SkipTwoEmptyLines) {
- ScopedTestFile file("foo : bar\n\n\nfoo : bar\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo : bar\n\n\nfoo : bar\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -170,8 +160,8 @@ TEST(ProcCpuInfoReaderTest, SkipTwoEmptyLines) {
}
TEST(ProcCpuInfoReaderTest, FieldWithSpaces) {
- ScopedTestFile file("foo bar : zoo\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo bar : zoo\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
@@ -183,8 +173,8 @@ TEST(ProcCpuInfoReaderTest, FieldWithSpaces) {
}
TEST(ProcCpuInfoReaderTest, EmptyValue) {
- ScopedTestFile file("foo :\n");
- ASSERT_TRUE(file.IsOk());
+ ScopedTmpFile file;
+ ASSERT_TRUE(file.InitString("foo :\n"));
ProcCpuInfoReader reader(file.GetFd());
const char* field;
diff --git a/src/client/linux/sender/google_crash_report_sender.cc b/src/client/linux/sender/google_crash_report_sender.cc
index 6f45d831..f6e48193 100644
--- a/src/client/linux/sender/google_crash_report_sender.cc
+++ b/src/client/linux/sender/google_crash_report_sender.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "common/linux/google_crashdump_uploader.h"
#include <string>
#include <iostream>
diff --git a/src/client/mac/crash_generation/crash_generation_client.cc b/src/client/mac/crash_generation/crash_generation_client.cc
index 32f1c827..7622dddd 100644
--- a/src/client/mac/crash_generation/crash_generation_client.cc
+++ b/src/client/mac/crash_generation/crash_generation_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/crash_generation/crash_generation_client.h"
#include "client/mac/crash_generation/crash_generation_server.h"
diff --git a/src/client/mac/crash_generation/crash_generation_server.cc b/src/client/mac/crash_generation/crash_generation_server.cc
index 6bbd4bb5..8d742f36 100644
--- a/src/client/mac/crash_generation/crash_generation_server.cc
+++ b/src/client/mac/crash_generation/crash_generation_server.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/crash_generation/crash_generation_server.h"
#include <pthread.h>
diff --git a/src/client/mac/handler/breakpad_nlist_64.cc b/src/client/mac/handler/breakpad_nlist_64.cc
index b4f04c91..d59c7b08 100644
--- a/src/client/mac/handler/breakpad_nlist_64.cc
+++ b/src/client/mac/handler/breakpad_nlist_64.cc
@@ -65,6 +65,10 @@
* I've modified it to be compatible with 64-bit images.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_nlist_64.h"
#include <CoreFoundation/CoreFoundation.h>
diff --git a/src/client/mac/handler/dynamic_images.cc b/src/client/mac/handler/dynamic_images.cc
index b1d2c464..3db7467b 100644
--- a/src/client/mac/handler/dynamic_images.cc
+++ b/src/client/mac/handler/dynamic_images.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/handler/dynamic_images.h"
extern "C" { // needed to compile on Leopard
diff --git a/src/client/mac/handler/exception_handler.cc b/src/client/mac/handler/exception_handler.cc
index c091209f..968e551c 100644
--- a/src/client/mac/handler/exception_handler.cc
+++ b/src/client/mac/handler/exception_handler.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <mach/exc.h>
#include <mach/mig.h>
#include <pthread.h>
diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc
index 3738416e..fd863aea 100644
--- a/src/client/mac/handler/minidump_generator.cc
+++ b/src/client/mac/handler/minidump_generator.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <algorithm>
#include <cstdio>
diff --git a/src/client/mac/handler/protected_memory_allocator.cc b/src/client/mac/handler/protected_memory_allocator.cc
index 83383263..8205a214 100644
--- a/src/client/mac/handler/protected_memory_allocator.cc
+++ b/src/client/mac/handler/protected_memory_allocator.cc
@@ -30,6 +30,10 @@
//
// See the header file for documentation
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "protected_memory_allocator.h"
#include <assert.h>
diff --git a/src/client/mac/handler/testcases/DynamicImagesTests.cc b/src/client/mac/handler/testcases/DynamicImagesTests.cc
index 14ea88d2..d7564fc9 100644
--- a/src/client/mac/handler/testcases/DynamicImagesTests.cc
+++ b/src/client/mac/handler/testcases/DynamicImagesTests.cc
@@ -33,6 +33,10 @@
// Copyright 2008 Google LLC
//
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/handler/testcases/DynamicImagesTests.h"
#include "client/mac/handler/dynamic_images.h"
diff --git a/src/client/mac/handler/testcases/breakpad_nlist_test.cc b/src/client/mac/handler/testcases/breakpad_nlist_test.cc
index a89d8c44..3779e357 100644
--- a/src/client/mac/handler/testcases/breakpad_nlist_test.cc
+++ b/src/client/mac/handler/testcases/breakpad_nlist_test.cc
@@ -33,6 +33,10 @@
// Copyright 2008 Google LLC
//
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/mac/handler/testcases/breakpad_nlist_test.h"
#include <mach-o/nlist.h>
#include "client/mac/handler/breakpad_nlist_64.h"
diff --git a/src/client/mac/tests/crash_generation_server_test.cc b/src/client/mac/tests/crash_generation_server_test.cc
index 50825a93..743b268e 100644
--- a/src/client/mac/tests/crash_generation_server_test.cc
+++ b/src/client/mac/tests/crash_generation_server_test.cc
@@ -29,6 +29,10 @@
// crash_generation_server_test.cc
// Unit tests for CrashGenerationServer
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <dirent.h>
#include <glob.h>
#include <stdint.h>
diff --git a/src/client/mac/tests/exception_handler_test.cc b/src/client/mac/tests/exception_handler_test.cc
index eb9aa1bc..91b931b9 100644
--- a/src/client/mac/tests/exception_handler_test.cc
+++ b/src/client/mac/tests/exception_handler_test.cc
@@ -28,6 +28,10 @@
// exception_handler_test.cc: Unit tests for google_breakpad::ExceptionHandler
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <sys/mman.h>
#include <sys/stat.h>
diff --git a/src/client/mac/tests/minidump_generator_test.cc b/src/client/mac/tests/minidump_generator_test.cc
index 1a889dfe..2606e14f 100644
--- a/src/client/mac/tests/minidump_generator_test.cc
+++ b/src/client/mac/tests/minidump_generator_test.cc
@@ -28,6 +28,10 @@
// minidump_generator_test.cc: Unit tests for google_breakpad::MinidumpGenerator
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <AvailabilityMacros.h>
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
diff --git a/src/client/mac/tests/minidump_generator_test_helper.cc b/src/client/mac/tests/minidump_generator_test_helper.cc
index 93cbe1bb..8177eeab 100644
--- a/src/client/mac/tests/minidump_generator_test_helper.cc
+++ b/src/client/mac/tests/minidump_generator_test_helper.cc
@@ -30,6 +30,10 @@
// minidump_generator_test.cc can launch to test certain things
// that require a separate executable.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <unistd.h>
#include "client/mac/handler/exception_handler.h"
diff --git a/src/client/minidump_file_writer.cc b/src/client/minidump_file_writer.cc
index d5193e2c..c00af36c 100644
--- a/src/client/minidump_file_writer.cc
+++ b/src/client/minidump_file_writer.cc
@@ -30,6 +30,10 @@
//
// See minidump_file_writer.h for documentation.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
diff --git a/src/client/minidump_file_writer_unittest.cc b/src/client/minidump_file_writer_unittest.cc
index bb3a0269..21e0b8a1 100644
--- a/src/client/minidump_file_writer_unittest.cc
+++ b/src/client/minidump_file_writer_unittest.cc
@@ -36,6 +36,10 @@
-o minidump_file_writer_unittest
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <unistd.h>
diff --git a/src/client/solaris/handler/exception_handler.cc b/src/client/solaris/handler/exception_handler.cc
index b7b702ac..0e5f4497 100644
--- a/src/client/solaris/handler/exception_handler.cc
+++ b/src/client/solaris/handler/exception_handler.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/src/client/solaris/handler/exception_handler_test.cc b/src/client/solaris/handler/exception_handler_test.cc
index a84f2df1..3d656820 100644
--- a/src/client/solaris/handler/exception_handler_test.cc
+++ b/src/client/solaris/handler/exception_handler_test.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <unistd.h>
diff --git a/src/client/solaris/handler/minidump_generator.cc b/src/client/solaris/handler/minidump_generator.cc
index 8f2f6ee2..5d24d0ae 100644
--- a/src/client/solaris/handler/minidump_generator.cc
+++ b/src/client/solaris/handler/minidump_generator.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <fcntl.h>
#include <sys/frame.h>
#include <sys/stat.h>
diff --git a/src/client/solaris/handler/minidump_test.cc b/src/client/solaris/handler/minidump_test.cc
index 00f8d9a5..a8f69063 100644
--- a/src/client/solaris/handler/minidump_test.cc
+++ b/src/client/solaris/handler/minidump_test.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <pthread.h>
#include <unistd.h>
diff --git a/src/client/solaris/handler/solaris_lwp.cc b/src/client/solaris/handler/solaris_lwp.cc
index d707a5b3..02f1c37e 100644
--- a/src/client/solaris/handler/solaris_lwp.cc
+++ b/src/client/solaris/handler/solaris_lwp.cc
@@ -28,6 +28,10 @@
// Author: Alfred Peng
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <dirent.h>
#include <elf.h>
#include <errno.h>
diff --git a/src/client/windows/crash_generation/client_info.cc b/src/client/windows/crash_generation/client_info.cc
index f0a4b911..61ee2126 100644
--- a/src/client/windows/crash_generation/client_info.cc
+++ b/src/client/windows/crash_generation/client_info.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/client_info.h"
#include "client/windows/common/ipc_protocol.h"
diff --git a/src/client/windows/crash_generation/crash_generation_client.cc b/src/client/windows/crash_generation/crash_generation_client.cc
index d6da09eb..c3d6a2bc 100644
--- a/src/client/windows/crash_generation/crash_generation_client.cc
+++ b/src/client/windows/crash_generation/crash_generation_client.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/crash_generation_client.h"
#include <cassert>
#include <utility>
diff --git a/src/client/windows/crash_generation/crash_generation_server.cc b/src/client/windows/crash_generation/crash_generation_server.cc
index bf80ee9c..61b0cbc0 100644
--- a/src/client/windows/crash_generation/crash_generation_server.cc
+++ b/src/client/windows/crash_generation/crash_generation_server.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/crash_generation_server.h"
#include <windows.h>
#include <cassert>
diff --git a/src/client/windows/crash_generation/minidump_generator.cc b/src/client/windows/crash_generation/minidump_generator.cc
index 523db27a..a0454cf9 100644
--- a/src/client/windows/crash_generation/minidump_generator.cc
+++ b/src/client/windows/crash_generation/minidump_generator.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/crash_generation/minidump_generator.h"
#include <assert.h>
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc
index 3b3938aa..64b29799 100644
--- a/src/client/windows/handler/exception_handler.cc
+++ b/src/client/windows/handler/exception_handler.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <objbase.h>
#include <algorithm>
diff --git a/src/client/windows/sender/crash_report_sender.cc b/src/client/windows/sender/crash_report_sender.cc
index 27a7ec39..6ce0026c 100644
--- a/src/client/windows/sender/crash_report_sender.cc
+++ b/src/client/windows/sender/crash_report_sender.cc
@@ -29,6 +29,10 @@
// Disable exception handler warnings.
#pragma warning( disable : 4530 )
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <errno.h>
#include "client/windows/sender/crash_report_sender.h"
diff --git a/src/client/windows/tests/crash_generation_app/abstract_class.cc b/src/client/windows/tests/crash_generation_app/abstract_class.cc
index 28b8ee14..737c817c 100644
--- a/src/client/windows/tests/crash_generation_app/abstract_class.cc
+++ b/src/client/windows/tests/crash_generation_app/abstract_class.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/tests/crash_generation_app/abstract_class.h"
namespace google_breakpad {
diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc
index 883afcc6..9ae4679e 100644
--- a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc
+++ b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc
@@ -29,6 +29,10 @@
// crash_generation_app.cpp : Defines the entry point for the application.
//
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/tests/crash_generation_app/crash_generation_app.h"
#include <windows.h>
diff --git a/src/client/windows/unittests/crash_generation_server_test.cc b/src/client/windows/unittests/crash_generation_server_test.cc
index cd624f07..adb03f40 100644
--- a/src/client/windows/unittests/crash_generation_server_test.cc
+++ b/src/client/windows/unittests/crash_generation_server_test.cc
@@ -27,6 +27,10 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "breakpad_googletest_includes.h"
#include "client/windows/crash_generation/crash_generation_server.h"
#include "client/windows/common/ipc_protocol.h"
diff --git a/src/client/windows/unittests/dump_analysis.cc b/src/client/windows/unittests/dump_analysis.cc
index 24a33769..c403d855 100644
--- a/src/client/windows/unittests/dump_analysis.cc
+++ b/src/client/windows/unittests/dump_analysis.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <objbase.h>
#include <dbghelp.h>
diff --git a/src/client/windows/unittests/exception_handler_death_test.cc b/src/client/windows/unittests/exception_handler_death_test.cc
index a7679dd6..50d3fda9 100644
--- a/src/client/windows/unittests/exception_handler_death_test.cc
+++ b/src/client/windows/unittests/exception_handler_death_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <dbghelp.h>
#include <strsafe.h>
diff --git a/src/client/windows/unittests/exception_handler_nesting_test.cc b/src/client/windows/unittests/exception_handler_nesting_test.cc
index 81ae7dc7..7fa6ac22 100644
--- a/src/client/windows/unittests/exception_handler_nesting_test.cc
+++ b/src/client/windows/unittests/exception_handler_nesting_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <string>
diff --git a/src/client/windows/unittests/exception_handler_test.cc b/src/client/windows/unittests/exception_handler_test.cc
index 237af29d..f658726b 100644
--- a/src/client/windows/unittests/exception_handler_test.cc
+++ b/src/client/windows/unittests/exception_handler_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include "client/windows/unittests/exception_handler_test.h"
#include <windows.h>
diff --git a/src/client/windows/unittests/minidump_test.cc b/src/client/windows/unittests/minidump_test.cc
index 7bfc8d77..741447df 100644
--- a/src/client/windows/unittests/minidump_test.cc
+++ b/src/client/windows/unittests/minidump_test.cc
@@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#ifdef HAVE_CONFIG_H
+#include <config.h> // Must come first
+#endif
+
#include <windows.h>
#include <objbase.h>
#include <dbghelp.h>