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_ANALYZER_UTIL_H_
16 : #define SYZYGY_REFINERY_ANALYZERS_ANALYZER_UTIL_H_
17 :
18 : #include <windows.h>
19 : #include <winnt.h>
20 :
21 : #include "syzygy/refinery/analyzers/analyzer.h"
22 :
23 m : namespace refinery {
24 :
25 : // fwd.
26 m : class RegisterInformation;
27 :
28 m : void ParseContext(const CONTEXT& ctx, RegisterInformation* register_info);
29 :
30 : // Provides the simplest possible implementation of the ProcessAnalysis
31 : // interface by storing ProcessState et al in member variables.
32 m : class SimpleProcessAnalysis : public Analyzer::ProcessAnalysis {
33 m : public:
34 : // Creates an instance with null symbol providers.
35 m : explicit SimpleProcessAnalysis(ProcessState* process_state);
36 m : SimpleProcessAnalysis(ProcessState* process_state,
37 m : scoped_refptr<DiaSymbolProvider> dia_symbol_provider,
38 m : scoped_refptr<SymbolProvider> symbol_provider);
39 :
40 : // @name ProcessAnalysis implementation.
41 : // @{
42 m : ProcessState* process_state() const override;
43 m : scoped_refptr<DiaSymbolProvider> dia_symbol_provider() const override;
44 m : scoped_refptr<SymbolProvider> symbol_provider() const override;
45 : // @}
46 :
47 m : void set_process_state(ProcessState* process_state) {
48 m : process_state_ = process_state;
49 m : }
50 m : void set_dia_symbol_provider(
51 m : scoped_refptr<DiaSymbolProvider> dia_symbol_provider) {
52 m : dia_symbol_provider_ = dia_symbol_provider;
53 m : }
54 m : void set_symbol_provider(scoped_refptr<SymbolProvider> symbol_provider) {
55 m : symbol_provider_ = symbol_provider;
56 m : }
57 :
58 m : private:
59 : // Not owned - the process state must outlive this instance.
60 m : ProcessState* process_state_;
61 m : scoped_refptr<DiaSymbolProvider> dia_symbol_provider_;
62 m : scoped_refptr<SymbolProvider> symbol_provider_;
63 m : };
64 :
65 m : } // namespace refinery
66 :
67 : #endif // SYZYGY_REFINERY_ANALYZERS_ANALYZER_UTIL_H_
|