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 m : namespace refinery {
20 :
21 m : AnalysisRunner::AnalysisRunner() {
22 m : }
23 :
24 m : AnalysisRunner::~AnalysisRunner() {
25 m : STLDeleteElements(&analyzers_);
26 m : }
27 :
28 m : void AnalysisRunner::AddAnalyzer(std::unique_ptr<Analyzer> analyzer) {
29 m : DCHECK(analyzer);
30 m : analyzers_.push_back(analyzer.release());
31 m : }
32 :
33 m : Analyzer::AnalysisResult AnalysisRunner::Analyze(
34 m : const minidump::Minidump& minidump,
35 m : const Analyzer::ProcessAnalysis& process_analysis) {
36 m : for (Analyzer* analyzer : analyzers_) {
37 m : Analyzer::AnalysisResult result =
38 m : analyzer->Analyze(minidump, process_analysis);
39 m : CHECK(result != Analyzer::ANALYSIS_ITERATE)
40 m : << "Iterative analysis is not supported.";
41 m : if (result != Analyzer::ANALYSIS_COMPLETE) {
42 m : LOG(ERROR) << analyzer->name() << " analysis failed";
43 m : return Analyzer::ANALYSIS_ERROR;
44 m : }
45 m : }
46 m : return Analyzer::ANALYSIS_COMPLETE;
47 m : }
48 :
49 m : } // namespace refinery
|