OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Crashpad Authors. 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 CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_ANNOTATIONS_READER_H_ |
| 16 #define CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_ANNOTATIONS_READER_H_ |
| 17 |
| 18 #include <map> |
| 19 #include <string> |
| 20 #include <vector> |
| 21 |
| 22 #include "base/basictypes.h" |
| 23 |
| 24 namespace crashpad { |
| 25 |
| 26 class PEImageReader; |
| 27 class ProcessReaderWin; |
| 28 |
| 29 //! \brief A reader of annotations stored in a PE image mapped into another |
| 30 //! process. |
| 31 //! |
| 32 //! These annotations are stored for the benefit of crash reporters, and provide |
| 33 //! information thought to be potentially useful for crash analysis. |
| 34 //! |
| 35 //! Currently, this class can decode information stored only in the CrashpadInfo |
| 36 //! structure. This format is used by Crashpad clients. The "simple annotations" |
| 37 //! are recovered from any module with a compatible data section, and are |
| 38 //! included in the annotations returned by SimpleMap(). |
| 39 class PEImageAnnotationsReader { |
| 40 public: |
| 41 //! \brief Constructs the object. |
| 42 //! |
| 43 //! \param[in] process_reader The reader for the remote process. |
| 44 //! \param[in] image_reader The PEImageReader for the PE image file contained |
| 45 //! within the remote process. |
| 46 //! \param[in] name The module's name, a string to be used in logged messages. |
| 47 //! This string is for diagnostic purposes only, and may be empty. |
| 48 PEImageAnnotationsReader(ProcessReaderWin* process_reader, |
| 49 const PEImageReader* pe_image_reader, |
| 50 const std::wstring& name); |
| 51 ~PEImageAnnotationsReader() {} |
| 52 |
| 53 //! \brief Returns the module's annotations that are organized as key-value |
| 54 //! pairs, where all keys and values are strings. |
| 55 std::map<std::string, std::string> SimpleMap() const; |
| 56 |
| 57 private: |
| 58 // Reads CrashpadInfo::simple_annotations_ on behalf of SimpleMap(). |
| 59 void ReadCrashpadSimpleAnnotations( |
| 60 std::map<std::string, std::string>* simple_map_annotations) const; |
| 61 |
| 62 std::wstring name_; |
| 63 ProcessReaderWin* process_reader_; // weak |
| 64 const PEImageReader* pe_image_reader_; // weak |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(PEImageAnnotationsReader); |
| 67 }; |
| 68 |
| 69 } // namespace crashpad |
| 70 |
| 71 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_ANNOTATIONS_READER_H_ |
OLD | NEW |