1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (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
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #include "syzygy/refinery/analyzers/analysis_runner.h"
16 :
17 : #include "base/stl_util.h"
18 :
19 : namespace refinery {
20 :
21 E : AnalysisRunner::AnalysisRunner() {
22 E : }
23 :
24 E : AnalysisRunner::~AnalysisRunner() {
25 E : STLDeleteElements(&analyzers_);
26 E : }
27 :
28 E : void AnalysisRunner::AddAnalyzer(scoped_ptr<Analyzer> analyzer) {
29 E : DCHECK(analyzer);
30 E : analyzers_.push_back(analyzer.release());
31 E : }
32 :
33 : Analyzer::AnalysisResult AnalysisRunner::Analyze(
34 : const minidump::Minidump& minidump,
35 E : ProcessState* process_state) {
36 E : for (Analyzer* analyzer : analyzers_) {
37 : Analyzer::AnalysisResult result =
38 E : analyzer->Analyze(minidump, process_state);
39 E : CHECK(result != Analyzer::ANALYSIS_ITERATE)
40 : << "Iterative analysis is not supported.";
41 E : if (result != Analyzer::ANALYSIS_COMPLETE) {
42 E : LOG(ERROR) << analyzer->name() << " analysis failed";
43 E : return Analyzer::ANALYSIS_ERROR;
44 : }
45 E : }
46 E : return Analyzer::ANALYSIS_COMPLETE;
47 E : }
48 :
49 : } // namespace refinery
|