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 : #ifndef SYZYGY_REFINERY_ANALYZERS_ANALYSIS_RUNNER_H_
16 : #define SYZYGY_REFINERY_ANALYZERS_ANALYSIS_RUNNER_H_
17 :
18 : #include <vector>
19 :
20 : #include "base/macros.h"
21 : #include "base/memory/scoped_ptr.h"
22 : #include "syzygy/minidump/minidump.h"
23 : #include "syzygy/refinery/analyzers/analyzer.h"
24 : #include "syzygy/refinery/process_state/process_state.h"
25 :
26 m : namespace refinery {
27 :
28 : // The analysis runner runs analyzers over a minidump to populate a process
29 : // state.
30 : // TODO(manzagop): support iterative analysis (analyzers returning
31 : // ANALYSIS_ITERATE).
32 m : class AnalysisRunner {
33 m : public:
34 m : AnalysisRunner();
35 m : ~AnalysisRunner();
36 :
37 : // Adds @p analyzer to the runner.
38 : // @param analyzer an analyzer to take ownership of. Deleted on runner's
39 : // destruction.
40 m : void AddAnalyzer(scoped_ptr<Analyzer> analyzer);
41 :
42 : // Runs analyzers over @p minidump and updates @p process_state.
43 : // @param minidump the minidump to analyze.
44 : // @param process_state the process state used as output for the analyzers.
45 : // @returns an analysis result. ANALYSIS_COMPLETE is returned if all analyzers
46 : // return it. Otherwise, ANALYSIS_ERROR is returned in which case @p
47 : // process_state may be inconsistent.
48 m : Analyzer::AnalysisResult Analyze(const minidump::Minidump& minidump,
49 m : ProcessState* process_state);
50 :
51 m : private:
52 m : std::vector<Analyzer*> analyzers_; // Owned.
53 :
54 m : DISALLOW_COPY_AND_ASSIGN(AnalysisRunner);
55 m : };
56 :
57 m : } // namespace refinery
58 :
59 : #endif // SYZYGY_REFINERY_ANALYZERS_ANALYSIS_RUNNER_H_
|