| OLD | NEW |
| 1 // Copyright 2015 Google Inc. All Rights Reserved. | 1 // Copyright 2015 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #ifndef SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_IMPL_H_ | 15 #ifndef SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_IMPL_H_ |
| 16 #define SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_IMPL_H_ | 16 #define SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_IMPL_H_ |
| 17 | 17 |
| 18 #include <dia2.h> | 18 #include <dia2.h> |
| 19 | 19 |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 22 #include "syzygy/refinery/process_state/layer_data.h" |
| 22 #include "syzygy/refinery/process_state/process_state.h" | 23 #include "syzygy/refinery/process_state/process_state.h" |
| 23 #include "syzygy/refinery/process_state/process_state_util.h" | 24 #include "syzygy/refinery/process_state/process_state_util.h" |
| 24 #include "syzygy/refinery/types/type_repository.h" | 25 #include "syzygy/refinery/types/type_repository.h" |
| 25 | 26 |
| 26 namespace refinery { | 27 namespace refinery { |
| 27 | 28 |
| 28 // A stack frame data analyzer analyzes data in the context of a stack frame and | 29 // A stack frame data analyzer analyzes data in the context of a stack frame and |
| 29 // populates a process state's typed block layer with the findings. | 30 // populates a process state's typed block layer with the findings. |
| 30 // @note Until we move away from using DIA for stack frame symbol information, | 31 // @note Until we move away from using DIA for stack frame symbol information, |
| 31 // this class also handles joining an IDiaSymbol to a Type via symbol name. | 32 // this class also handles joining an IDiaSymbol to a Type via symbol name. |
| 32 class StackFrameDataAnalyzer { | 33 class StackFrameDataAnalyzer { |
| 33 public: | 34 public: |
| 34 StackFrameDataAnalyzer(StackFrameRecordPtr frame_record, | 35 StackFrameDataAnalyzer(StackFrameRecordPtr frame_record, |
| 35 scoped_refptr<TypeNameIndex> typename_index, | 36 scoped_refptr<TypeNameIndex> typename_index, |
| 37 ModuleId module_id, |
| 36 ProcessState* process_state); | 38 ProcessState* process_state); |
| 37 | 39 |
| 38 // Analyze @p data in the context of the frame record to populate the process | 40 // Analyze @p data in the context of the frame record to populate the process |
| 39 // state's typed block layer. | 41 // state's typed block layer. |
| 40 // @pre data is of type SymTagData. | 42 // @pre data is of type SymTagData. |
| 41 // @param data the dia symbol of type SymTagData to analyze. | 43 // @param data the dia symbol of type SymTagData to analyze. |
| 42 // @returns true on success analysis, false otherwise. | 44 // @returns true on success analysis, false otherwise. |
| 43 // @note Successful analysis does not necessarily mean modifying the process | 45 // @note Successful analysis does not necessarily mean modifying the process |
| 44 // state. | 46 // state. |
| 45 bool Analyze(IDiaSymbol* data); | 47 bool Analyze(IDiaSymbol* data); |
| 46 | 48 |
| 47 private: | 49 private: |
| 48 bool GetAddressRange(IDiaSymbol* data, AddressRange* range); | 50 bool GetAddressRange(IDiaSymbol* data, TypePtr type, AddressRange* range); |
| 49 bool GetAddressRangeRegRel(IDiaSymbol* data, AddressRange* range); | 51 bool GetAddressRangeRegRel(IDiaSymbol* data, |
| 52 TypePtr type, |
| 53 AddressRange* range); |
| 50 | 54 |
| 51 StackFrameRecordPtr frame_record_; | 55 StackFrameRecordPtr frame_record_; |
| 52 scoped_refptr<TypeNameIndex> typename_index_; | 56 scoped_refptr<TypeNameIndex> typename_index_; |
| 57 ModuleId module_id_; |
| 53 // Not owned. Must outlive the StackFrameDataAnalyzer. | 58 // Not owned. Must outlive the StackFrameDataAnalyzer. |
| 54 ProcessState* process_state_; | 59 ProcessState* process_state_; |
| 55 | 60 |
| 56 DISALLOW_COPY_AND_ASSIGN(StackFrameDataAnalyzer); | 61 DISALLOW_COPY_AND_ASSIGN(StackFrameDataAnalyzer); |
| 57 }; | 62 }; |
| 58 | 63 |
| 59 } // namespace refinery | 64 } // namespace refinery |
| 60 | 65 |
| 61 #endif // SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_IMPL_H_ | 66 #endif // SYZYGY_REFINERY_ANALYZERS_STACK_FRAME_ANALYZER_IMPL_H_ |
| OLD | NEW |