Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: components/breakpad/app/breakpad_linux_impl.h

Issue 296553002: Breakpad Linux: Prevent some memory leaks. (Try 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix asan Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Internal header file for the Linux breakpad implementation. This file is 5 // Internal header file for the Linux breakpad implementation. This file is
6 // shared between crash_handler_host_linux.cc and breakpad_linux.cc. It should 6 // shared between crash_handler_host_linux.cc and breakpad_linux.cc. It should
7 // only be used in files compiled with linux_breakpad=1. 7 // only be used in files compiled with linux_breakpad=1.
8 8
9 #ifndef COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_ 9 #ifndef COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_
10 #define COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_ 10 #define COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_
11 11
12 #include <sys/types.h> 12 #include <sys/types.h>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "breakpad/src/common/simple_string_dictionary.h" 15 #include "breakpad/src/common/simple_string_dictionary.h"
16 #include "components/breakpad/app/breakpad_linux.h" 16 #include "components/breakpad/app/breakpad_linux.h"
17 17
18 namespace breakpad { 18 namespace breakpad {
19 19
20 typedef google_breakpad::NonAllocatingMap<256, 256, 64> CrashKeyStorage; 20 typedef google_breakpad::NonAllocatingMap<256, 256, 64> CrashKeyStorage;
21 21
22 static const size_t kDistroSize = 128;
23 #if defined(ADDRESS_SANITIZER) 22 #if defined(ADDRESS_SANITIZER)
24 static const size_t kMaxAsanReportSize = 1 << 16; 23 static const size_t kMaxAsanReportSize = 1 << 16;
25 #endif 24 #endif
26 // Define a preferred limit on minidump sizes, because Crash Server currently 25 // Define a preferred limit on minidump sizes, because Crash Server currently
27 // throws away any larger than 1.2MB (1.2 * 1024 * 1024). A value of -1 means 26 // throws away any larger than 1.2MB (1.2 * 1024 * 1024). A value of -1 means
28 // no limit. 27 // no limit.
29 static const off_t kMaxMinidumpFileSize = 1258291; 28 static const off_t kMaxMinidumpFileSize = 1258291;
30 29
31 // The size of the iovec used to transfer crash data from a child back to the 30 // The size of the iovec used to transfer crash data from a child back to the
32 // browser. 31 // browser.
33 #if !defined(ADDRESS_SANITIZER) 32 #if !defined(ADDRESS_SANITIZER)
34 const size_t kCrashIovSize = 7; 33 const size_t kCrashIovSize = 6;
35 #else 34 #else
36 // Additional field to pass the AddressSanitizer log to the crash handler. 35 // Additional field to pass the AddressSanitizer log to the crash handler.
37 const size_t kCrashIovSize = 8; 36 const size_t kCrashIovSize = 7;
38 #endif 37 #endif
39 38
40 // BreakpadInfo describes a crash report. 39 // BreakpadInfo describes a crash report.
41 // The minidump information can either be contained in a file descriptor (fd) or 40 // The minidump information can either be contained in a file descriptor (fd) or
42 // in a file (whose path is in filename). 41 // in a file (whose path is in filename).
43 struct BreakpadInfo { 42 struct BreakpadInfo {
44 int fd; // File descriptor to the Breakpad dump data. 43 int fd; // File descriptor to the Breakpad dump data.
45 const char* filename; // Path to the Breakpad dump data. 44 const char* filename; // Path to the Breakpad dump data.
46 #if defined(ADDRESS_SANITIZER) 45 #if defined(ADDRESS_SANITIZER)
47 const char* log_filename; // Path to the ASan log file. 46 const char* log_filename; // Path to the ASan log file.
48 const char* asan_report_str; // ASan report. 47 const char* asan_report_str; // ASan report.
49 unsigned asan_report_length; // Length of |asan_report_length|. 48 unsigned asan_report_length; // Length of |asan_report_length|.
50 #endif 49 #endif
51 const char* process_type; // Process type, e.g. "renderer". 50 const char* process_type; // Process type, e.g. "renderer".
52 unsigned process_type_length; // Length of |process_type|. 51 unsigned process_type_length; // Length of |process_type|.
53 const char* distro; // Linux distro string. 52 const char* distro; // Linux distro string.
54 unsigned distro_length; // Length of |distro|. 53 unsigned distro_length; // Length of |distro|.
55 bool upload; // Whether to upload or save crash dump. 54 bool upload; // Whether to upload or save crash dump.
56 uint64_t process_start_time; // Uptime of the crashing process. 55 uint64_t process_start_time; // Uptime of the crashing process.
57 size_t oom_size; // Amount of memory requested if OOM. 56 size_t oom_size; // Amount of memory requested if OOM.
58 uint64_t pid; // PID where applicable. 57 uint64_t pid; // PID where applicable.
59 CrashKeyStorage* crash_keys; 58 CrashKeyStorage* crash_keys;
60 }; 59 };
61 60
62 extern void HandleCrashDump(const BreakpadInfo& info); 61 extern void HandleCrashDump(const BreakpadInfo& info);
63 62
64 } // namespace breakpad 63 } // namespace breakpad
65 64
66 #endif // COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_ 65 #endif // COMPONENTS_BREAKPAD_APP_BREAKPAD_LINUX_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698