#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <poll.h>
#include <pthread.h>
#include <stdint.h>
#include <unistd.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/wait.h>
#if defined(__mips__)
#include <sys/cachectl.h>
#endif
#include <string>
#include "breakpad_googletest_includes.h"
#include "client/linux/handler/exception_handler.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include "common/linux/eintr_wrapper.h"
#include "common/linux/ignore_ret.h"
#include "common/linux/linux_libc_support.h"
#include "common/tests/auto_tempdir.h"
#include "common/using_std_string.h"
#include "third_party/lss/linux_syscall_support.h"
#include "google_breakpad/processor/minidump.h"
usingnamespacegoogle_breakpad;
namespace {
void FlushInstructionCache(const char* memory, uint32_t memory_size) { … }
void sigchld_handler(int signo) { … }
int CreateTMPFile(const string& dir, string* path) { … }
class ExceptionHandlerTest : public ::testing::Test { … };
void WaitForProcessToTerminate(pid_t process_id, int expected_status) { … }
void ReadMinidumpPathFromPipe(int fd, string* path) { … }
}
TEST(ExceptionHandlerTest, SimpleWithPath) { … }
TEST(ExceptionHandlerTest, SimpleWithFD) { … }
static bool DoneCallback(const MinidumpDescriptor& descriptor,
void* context,
bool succeeded) { … }
#ifndef ADDRESS_SANITIZER
volatile int* p_null;
static void DoNullPointerDereference() { … }
void ChildCrash(bool use_fd) { … }
TEST(ExceptionHandlerTest, ChildCrashWithPath) { … }
TEST(ExceptionHandlerTest, ChildCrashWithFD) { … }
#if !defined(__ANDROID_API__) || __ANDROID_API__ >= __ANDROID_API_N__
static void* SleepFunction(void* unused) { … }
static void* CrashFunction(void* b_ptr) { … }
TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) { … }
#endif
static bool DoneCallbackReturnFalse(const MinidumpDescriptor& descriptor,
void* context,
bool succeeded) { … }
static bool DoneCallbackReturnTrue(const MinidumpDescriptor& descriptor,
void* context,
bool succeeded) { … }
static bool DoneCallbackRaiseSIGKILL(const MinidumpDescriptor& descriptor,
void* context,
bool succeeded) { … }
static bool FilterCallbackReturnFalse(void* context) { … }
static bool FilterCallbackReturnTrue(void* context) { … }
static void RaiseSIGKILL(int sig) { … }
static bool InstallRaiseSIGKILL() { … }
static void CrashWithCallbacks(ExceptionHandler::FilterCallback filter,
ExceptionHandler::MinidumpCallback done,
string path) { … }
TEST(ExceptionHandlerTest, RedeliveryOnFilterCallbackFalse) { … }
TEST(ExceptionHandlerTest, RedeliveryOnDoneCallbackFalse) { … }
TEST(ExceptionHandlerTest, NoRedeliveryOnDoneCallbackTrue) { … }
TEST(ExceptionHandlerTest, NoRedeliveryOnFilterCallbackTrue) { … }
TEST(ExceptionHandlerTest, RedeliveryToDefaultHandler) { … }
TEST(ExceptionHandlerTest, RedeliveryOnBadSignalHandlerFlag) { … }
TEST(ExceptionHandlerTest, StackedHandlersDeliveredToTop) { … }
TEST(ExceptionHandlerTest, StackedHandlersNotDeliveredToBottom) { … }
TEST(ExceptionHandlerTest, StackedHandlersFilteredToBottom) { … }
TEST(ExceptionHandlerTest, StackedHandlersUnhandledToBottom) { … }
namespace {
const int kSimpleFirstChanceReturnStatus = …;
bool SimpleFirstChanceHandler(int, siginfo_t*, void*) { … }
}
TEST(ExceptionHandlerTest, FirstChanceHandlerRuns) { … }
#endif
const unsigned char kIllegalInstruction[] = …;
TEST(ExceptionHandlerTest, InstructionPointerMemory) { … }
TEST(ExceptionHandlerTest, InstructionPointerMemoryMinBound) { … }
TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) { … }
#ifndef ADDRESS_SANITIZER
TEST(ExceptionHandlerTest, InstructionPointerMemoryNullPointer) { … }
#endif
TEST(ExceptionHandlerTest, ModuleInfo) { … }
#ifndef ADDRESS_SANITIZER
static const unsigned kControlMsgSize = …;
static bool
CrashHandler(const void* crash_context, size_t crash_context_size,
void* context) { … }
TEST(ExceptionHandlerTest, ExternalDumper) { … }
#endif
TEST(ExceptionHandlerTest, WriteMinidumpExceptionStream) { … }
TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithFD) { … }
TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) { … }
TEST(ExceptionHandlerTest, AdditionalMemory) { … }
TEST(ExceptionHandlerTest, AdditionalMemoryRemove) { … }
static bool SimpleCallback(const MinidumpDescriptor& descriptor,
void* context,
bool succeeded) { … }
TEST(ExceptionHandlerTest, WriteMinidumpForChild) { … }