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

Side by Side Diff: syzygy/agent/asan/reporters/crashpad_reporter.cc

Issue 1992773002: [SyzyAsan] Enable Crashpad reporter as a 50/50 experiment. (Closed) Base URL: https://github.com/google/syzygy.git@master
Patch Set: Fix broken unittest. Created 4 years, 6 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
« no previous file with comments | « syzygy/agent/asan/reporters/crashpad_reporter.h ('k') | syzygy/agent/asan/rtl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 Google Inc. All Rights Reserved. 1 // Copyright 2016 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return false; 63 return false;
64 if (!g_crashpad_client.UseHandler()) 64 if (!g_crashpad_client.UseHandler())
65 return false; 65 return false;
66 66
67 crashpad_present = true; 67 crashpad_present = true;
68 return true; 68 return true;
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 const char CrashpadReporter::kName[] = "CrashpadReporter";
74
73 // static 75 // static
74 std::unique_ptr<CrashpadReporter> CrashpadReporter::Create() { 76 std::unique_ptr<CrashpadReporter> CrashpadReporter::Create() {
75 // Create a crashpad reporter only if a crashpad instance is running for this 77 // Create a crashpad reporter only if a crashpad instance is running for this
76 // process. 78 // process.
77 if (!EnsureCrashpadConnected()) 79 if (!EnsureCrashpadConnected())
78 return nullptr; 80 return nullptr;
79 81
80 auto crashpad_info = crashpad::CrashpadInfo::GetCrashpadInfo(); 82 auto crashpad_info = crashpad::CrashpadInfo::GetCrashpadInfo();
81 return std::unique_ptr<CrashpadReporter>(new CrashpadReporter(crashpad_info)); 83 return std::unique_ptr<CrashpadReporter>(new CrashpadReporter(crashpad_info));
82 } 84 }
83 85
84 const char* CrashpadReporter::GetName() const { 86 const char* CrashpadReporter::GetName() const {
85 return "CrashpadReporter"; 87 return kName;
86 } 88 }
87 89
88 uint32_t CrashpadReporter::GetFeatures() const { 90 uint32_t CrashpadReporter::GetFeatures() const {
89 return FEATURE_CRASH_KEYS | FEATURE_EARLY_CRASH_KEYS | 91 return FEATURE_CRASH_KEYS | FEATURE_EARLY_CRASH_KEYS |
90 FEATURE_MEMORY_RANGES | FEATURE_CUSTOM_STREAMS | 92 FEATURE_MEMORY_RANGES | FEATURE_CUSTOM_STREAMS |
91 FEATURE_DUMP_WITHOUT_CRASH; 93 FEATURE_DUMP_WITHOUT_CRASH;
92 } 94 }
93 95
94 bool CrashpadReporter::SetCrashKey(base::StringPiece key, 96 bool CrashpadReporter::SetCrashKey(base::StringPiece key,
95 base::StringPiece value) { 97 base::StringPiece value) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 162
161 bool CrashpadReporter::DumpWithoutCrash(const CONTEXT& context) { 163 bool CrashpadReporter::DumpWithoutCrash(const CONTEXT& context) {
162 g_crashpad_client.DumpWithoutCrash(context); 164 g_crashpad_client.DumpWithoutCrash(context);
163 return true; 165 return true;
164 } 166 }
165 167
166 CrashpadReporter::CrashpadReporter(crashpad::CrashpadInfo* crashpad_info) 168 CrashpadReporter::CrashpadReporter(crashpad::CrashpadInfo* crashpad_info)
167 : crashpad_info_(crashpad_info) { 169 : crashpad_info_(crashpad_info) {
168 crash_keys_.reset(new crashpad::SimpleStringDictionary()); 170 crash_keys_.reset(new crashpad::SimpleStringDictionary());
169 171
170 // Initialize the crashpad info struct. 172 // Initialize the crashpad info struct. Limit indirectly referenced memory to
173 // a maximum of 1MB, so that crash reports come in at around 1.5-1.7MB. This
174 // is similar to the size of SyzyAsan crash reports generated by MS tools.
171 crashpad_info->set_crashpad_handler_behavior( 175 crashpad_info->set_crashpad_handler_behavior(
172 crashpad::TriState::kEnabled); 176 crashpad::TriState::kEnabled);
173 crashpad_info->set_system_crash_reporter_forwarding( 177 crashpad_info->set_system_crash_reporter_forwarding(
174 crashpad::TriState::kDisabled); 178 crashpad::TriState::kDisabled);
175 crashpad_info->set_gather_indirectly_referenced_memory( 179 crashpad_info->set_gather_indirectly_referenced_memory(
176 crashpad::TriState::kEnabled); 180 crashpad::TriState::kEnabled, 1 * 1024 * 1024);
177 crashpad_info->set_simple_annotations(crash_keys_.get()); 181 crashpad_info->set_simple_annotations(crash_keys_.get());
178 } 182 }
179 183
180 } // namespace reporters 184 } // namespace reporters
181 } // namespace asan 185 } // namespace asan
182 } // namespace agent 186 } // namespace agent
OLDNEW
« no previous file with comments | « syzygy/agent/asan/reporters/crashpad_reporter.h ('k') | syzygy/agent/asan/rtl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698