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_STACK_FRAME_ANALYZER_H_
16 : #define SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_H_
17 :
18 : #include <dia2.h>
19 :
20 : #include "base/macros.h"
21 : #include "base/memory/ref_counted.h"
22 : #include "syzygy/refinery/analyzers/analyzer.h"
23 : #include "syzygy/refinery/process_state/process_state_util.h"
24 : #include "syzygy/refinery/symbols/dia_symbol_provider.h"
25 : #include "syzygy/refinery/symbols/symbol_provider.h"
26 : #include "syzygy/refinery/types/type_repository.h"
27 :
28 m : namespace refinery {
29 :
30 : // The stack frame analyzer populates the process state with information
31 : // about the contents of stack frames.
32 m : class StackFrameAnalyzer : public Analyzer {
33 m : public:
34 m : StackFrameAnalyzer();
35 :
36 m : const char* name() const override { return kStackFrameAnalyzerName; }
37 :
38 m : AnalysisResult Analyze(const minidump::Minidump& minidump,
39 m : const ProcessAnalysis& process_analysis) override;
40 :
41 m : ANALYZER_INPUT_LAYERS(ProcessState::BytesLayer,
42 m : ProcessState::ModuleLayer,
43 m : ProcessState::StackFrameLayer)
44 m : ANALYZER_OUTPUT_LAYERS(ProcessState::TypedBlockLayer)
45 :
46 m : private:
47 m : bool AnalyzeFrame(StackFrameRecordPtr frame_record,
48 m : const ProcessAnalysis& process_analysis);
49 m : bool SetSymbolInformation(Address instruction_pointer,
50 m : const ProcessAnalysis& process_analysis);
51 :
52 m : static const char kStackFrameAnalyzerName[];
53 :
54 : // Symbol information for the frame being processed.
55 m : base::win::ScopedComPtr<IDiaSession> dia_session_;
56 m : scoped_refptr<TypeNameIndex> typename_index_;
57 :
58 m : DISALLOW_COPY_AND_ASSIGN(StackFrameAnalyzer);
59 m : };
60 :
61 m : } // namespace refinery
62 :
63 : #endif // SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_H_
|