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

Side by Side Diff: components/browser_watcher/stability_report_extractor.cc

Issue 2927653003: Stability instrumentation: add a Vectored Exception Handler (Closed)
Patch Set: merge Created 3 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/browser_watcher/stability_report_extractor.h" 5 #include "components/browser_watcher/stability_report_extractor.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 case base::debug::Activity::ACT_GENERIC: 174 case base::debug::Activity::ACT_GENERIC:
175 collected->set_type(Activity::ACT_GENERIC); 175 collected->set_type(Activity::ACT_GENERIC);
176 collected->set_generic_id(recorded.data.generic.id); 176 collected->set_generic_id(recorded.data.generic.id);
177 collected->set_generic_data(recorded.data.generic.info); 177 collected->set_generic_data(recorded.data.generic.info);
178 break; 178 break;
179 default: 179 default:
180 break; 180 break;
181 } 181 }
182 } 182 }
183 183
184 void CollectException(const base::debug::Activity& recorded,
185 Exception* collected) {
186 DCHECK(collected);
187 collected->set_code(recorded.data.exception.code);
188 collected->set_program_counter(recorded.calling_address);
189 collected->set_exception_address(recorded.origin_address);
190 collected->set_time(recorded.time_internal);
191 }
192
184 void CollectThread( 193 void CollectThread(
185 const base::debug::ThreadActivityAnalyzer::Snapshot& snapshot, 194 const base::debug::ThreadActivityAnalyzer::Snapshot& snapshot,
186 ThreadState* thread_state) { 195 ThreadState* thread_state) {
187 DCHECK(thread_state); 196 DCHECK(thread_state);
188 197
189 thread_state->set_thread_name(snapshot.thread_name); 198 thread_state->set_thread_name(snapshot.thread_name);
190 thread_state->set_thread_id(snapshot.thread_id); 199 thread_state->set_thread_id(snapshot.thread_id);
191 thread_state->set_activity_count(snapshot.activity_stack_depth); 200 thread_state->set_activity_count(snapshot.activity_stack_depth);
192 201
202 if (snapshot.last_exception.activity_type ==
203 base::debug::Activity::ACT_EXCEPTION) {
204 CollectException(snapshot.last_exception,
205 thread_state->mutable_exception());
206 }
207
193 for (size_t i = 0; i < snapshot.activity_stack.size(); ++i) { 208 for (size_t i = 0; i < snapshot.activity_stack.size(); ++i) {
194 Activity* collected = thread_state->add_activities(); 209 Activity* collected = thread_state->add_activities();
195 210
196 CollectActivity(snapshot.activity_stack[i], collected); 211 CollectActivity(snapshot.activity_stack[i], collected);
197 if (i < snapshot.user_data_stack.size()) { 212 if (i < snapshot.user_data_stack.size()) {
198 CollectUserData(snapshot.user_data_stack[i], 213 CollectUserData(snapshot.user_data_stack[i],
199 collected->mutable_user_data(), nullptr); 214 collected->mutable_user_data(), nullptr);
200 } 215 }
201 } 216 }
202 } 217 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 CollectThread(thread_analyzer->activity_snapshot(), thread_state); 276 CollectThread(thread_analyzer->activity_snapshot(), thread_state);
262 } 277 }
263 278
264 // Collect module information. 279 // Collect module information.
265 CollectModuleInformation(global_analyzer->GetModules(), process_state); 280 CollectModuleInformation(global_analyzer->GetModules(), process_state);
266 281
267 return SUCCESS; 282 return SUCCESS;
268 } 283 }
269 284
270 } // namespace browser_watcher 285 } // namespace browser_watcher
OLDNEW
« no previous file with comments | « components/browser_watcher/stability_report.proto ('k') | components/browser_watcher/stability_report_extractor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698