#include "handler/linux/crash_report_exception_handler.h"
#include <memory>
#include <utility>
#include "base/logging.h"
#include "build/build_config.h"
#include "client/settings.h"
#include "handler/linux/capture_snapshot.h"
#include "minidump/minidump_file_writer.h"
#include "snapshot/linux/process_snapshot_linux.h"
#include "snapshot/sanitized/process_snapshot_sanitized.h"
#include "util/file/file_helper.h"
#include "util/file/file_reader.h"
#include "util/file/output_stream_file_writer.h"
#include "util/linux/direct_ptrace_connection.h"
#include "util/linux/ptrace_client.h"
#include "util/misc/implicit_cast.h"
#include "util/misc/metrics.h"
#include "util/misc/uuid.h"
#include "util/stream/base94_output_stream.h"
#include "util/stream/log_output_stream.h"
#include "util/stream/zlib_output_stream.h"
#if BUILDFLAG(IS_ANDROID)
#include <android/log.h>
#endif
namespace crashpad {
namespace {
class Logger final : public LogOutputStream::Delegate { … };
bool WriteMinidumpLogFromFile(FileReaderInterface* file_reader) { … }
}
CrashReportExceptionHandler::CrashReportExceptionHandler(
CrashReportDatabase* database,
CrashReportUploadThread* upload_thread,
const std::map<std::string, std::string>* process_annotations,
const std::vector<base::FilePath>* attachments,
bool write_minidump_to_database,
bool write_minidump_to_log,
const UserStreamDataSources* user_stream_data_sources)
: … { … }
CrashReportExceptionHandler::~CrashReportExceptionHandler() = default;
bool CrashReportExceptionHandler::HandleException(
pid_t client_process_id,
uid_t client_uid,
const ExceptionHandlerProtocol::ClientInformation& info,
VMAddress requesting_thread_stack_address,
pid_t* requesting_thread_id,
UUID* local_report_id) { … }
bool CrashReportExceptionHandler::HandleExceptionWithBroker(
pid_t client_process_id,
uid_t client_uid,
const ExceptionHandlerProtocol::ClientInformation& info,
int broker_sock,
UUID* local_report_id) { … }
bool CrashReportExceptionHandler::HandleExceptionWithConnection(
PtraceConnection* connection,
const ExceptionHandlerProtocol::ClientInformation& info,
uid_t client_uid,
VMAddress requesting_thread_stack_address,
pid_t* requesting_thread_id,
UUID* local_report_id) { … }
bool CrashReportExceptionHandler::WriteMinidumpToDatabase(
ProcessSnapshotLinux* process_snapshot,
ProcessSnapshotSanitized* sanitized_snapshot,
bool write_minidump_to_log,
UUID* local_report_id) { … }
bool CrashReportExceptionHandler::WriteMinidumpToLog(
ProcessSnapshotLinux* process_snapshot,
ProcessSnapshotSanitized* sanitized_snapshot) { … }
}