1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Internal header file for the Linux breakpad implementation. This file is 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// shared between crash_handler_host_linux.cc and breakpad_linux.cc. It should 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// only be used in files compiled with linux_breakpad=1. 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#ifndef COMPONENTS_CRASH_APP_BREAKPAD_LINUX_IMPL_H_ 101320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#define COMPONENTS_CRASH_APP_BREAKPAD_LINUX_IMPL_H_ 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <sys/types.h> 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/basictypes.h" 15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "breakpad/src/common/simple_string_dictionary.h" 161320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "components/crash/app/breakpad_linux.h" 178bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 188bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)namespace breakpad { 19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)typedef google_breakpad::NonAllocatingMap<256, 256, 64> CrashKeyStorage; 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#if defined(ADDRESS_SANITIZER) 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)static const size_t kMaxAsanReportSize = 1 << 16; 24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif 25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Define a preferred limit on minidump sizes, because Crash Server currently 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// throws away any larger than 1.2MB (1.2 * 1024 * 1024). A value of -1 means 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// no limit. 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)static const off_t kMaxMinidumpFileSize = 1258291; 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// The size of the iovec used to transfer crash data from a child back to the 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// browser. 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#if !defined(ADDRESS_SANITIZER) 33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)const size_t kCrashIovSize = 6; 34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#else 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Additional field to pass the AddressSanitizer log to the crash handler. 36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)const size_t kCrashIovSize = 7; 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// BreakpadInfo describes a crash report. 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// The minidump information can either be contained in a file descriptor (fd) or 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// in a file (whose path is in filename). 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)struct BreakpadInfo { 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int fd; // File descriptor to the Breakpad dump data. 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const char* filename; // Path to the Breakpad dump data. 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#if defined(ADDRESS_SANITIZER) 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const char* log_filename; // Path to the ASan log file. 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const char* asan_report_str; // ASan report. 48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) unsigned asan_report_length; // Length of |asan_report_length|. 49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif 50868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const char* process_type; // Process type, e.g. "renderer". 51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) unsigned process_type_length; // Length of |process_type|. 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const char* distro; // Linux distro string. 53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) unsigned distro_length; // Length of |distro|. 54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool upload; // Whether to upload or save crash dump. 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) uint64_t process_start_time; // Uptime of the crashing process. 56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) size_t oom_size; // Amount of memory requested if OOM. 57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) uint64_t pid; // PID where applicable. 58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) CrashKeyStorage* crash_keys; 59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)extern void HandleCrashDump(const BreakpadInfo& info); 62868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 638bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)} // namespace breakpad 648bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 651320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif // COMPONENTS_CRASH_APP_BREAKPAD_LINUX_IMPL_H_ 66