OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. 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 CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ |
16 #define CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ | 16 #define CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ |
17 | 17 |
18 #include <windows.h> | 18 #include <windows.h> |
19 | 19 |
20 #include <string> | 20 #include <string> |
21 | 21 |
22 #include "base/basictypes.h" | 22 #include "base/basictypes.h" |
23 #include "util/misc/initialization_state_dcheck.h" | 23 #include "util/misc/initialization_state_dcheck.h" |
24 #include "util/misc/uuid.h" | 24 #include "util/misc/uuid.h" |
25 #include "util/win/address_types.h" | 25 #include "util/win/address_types.h" |
26 #include "util/win/checked_win_address_range.h" | 26 #include "util/win/checked_win_address_range.h" |
| 27 #include "util/win/process_structs.h" |
27 | 28 |
28 namespace crashpad { | 29 namespace crashpad { |
29 | 30 |
30 class ProcessReaderWin; | 31 class ProcessReaderWin; |
31 | 32 |
32 namespace process_types { | 33 namespace process_types { |
33 | 34 |
34 // TODO(scottmg): Genericize and/or? move process_types out of mac/. | 35 template <class Traits> |
35 struct CrashpadInfo { | 36 struct CrashpadInfo { |
36 uint32_t signature; | 37 uint32_t signature; |
37 uint32_t size; | 38 uint32_t size; |
38 uint32_t version; | 39 uint32_t version; |
39 uint8_t crashpad_handler_behavior; // TriState. | 40 uint8_t crashpad_handler_behavior; // TriState. |
40 uint8_t system_crash_reporter_forwarding; // TriState. | 41 uint8_t system_crash_reporter_forwarding; // TriState. |
41 uint16_t padding_0; | 42 uint16_t padding_0; |
42 uint64_t simple_annotations; // TODO(scottmg): x86/64. | 43 typename Traits::Pointer simple_annotations; |
43 }; | |
44 | |
45 struct Section { | |
46 }; | 44 }; |
47 | 45 |
48 } // namespace process_types | 46 } // namespace process_types |
49 | 47 |
50 //! \brief A reader for PE images mapped into another process. | 48 //! \brief A reader for PE images mapped into another process. |
51 //! | 49 //! |
52 //! This class is capable of reading both 32-bit and 64-bit images based on the | 50 //! This class is capable of reading both 32-bit and 64-bit images based on the |
53 //! bitness of the remote process. | 51 //! bitness of the remote process. |
54 //! | 52 //! |
55 //! \sa PEImageAnnotationsReader | 53 //! \sa PEImageAnnotationsReader |
(...skipping 29 matching lines...) Expand all Loading... |
85 //! \brief Returns the image's size. | 83 //! \brief Returns the image's size. |
86 //! | 84 //! |
87 //! This is the value passed as \a size to Initialize(). | 85 //! This is the value passed as \a size to Initialize(). |
88 WinVMSize Size() const { return module_range_.Size(); } | 86 WinVMSize Size() const { return module_range_.Size(); } |
89 | 87 |
90 //! \brief Obtains the module's CrashpadInfo structure. | 88 //! \brief Obtains the module's CrashpadInfo structure. |
91 //! | 89 //! |
92 //! \return `true` on success, `false` on failure. If the module does not have | 90 //! \return `true` on success, `false` on failure. If the module does not have |
93 //! a `CPADinfo` section, this will return `false` without logging any | 91 //! a `CPADinfo` section, this will return `false` without logging any |
94 //! messages. Other failures will result in messages being logged. | 92 //! messages. Other failures will result in messages being logged. |
95 bool GetCrashpadInfo(process_types::CrashpadInfo* crashpad_info) const; | 93 template <class Traits> |
| 94 bool GetCrashpadInfo( |
| 95 process_types::CrashpadInfo<Traits>* crashpad_info) const; |
96 | 96 |
97 //! \brief Obtains information from the module's debug directory, if any. | 97 //! \brief Obtains information from the module's debug directory, if any. |
98 //! | 98 //! |
99 //! \param[out] uuid The unique identifier of the executable/PDB. | 99 //! \param[out] uuid The unique identifier of the executable/PDB. |
100 //! \param[out] age The age field for the pdb (the number of times it's been | 100 //! \param[out] age The age field for the pdb (the number of times it's been |
101 //! relinked). | 101 //! relinked). |
102 //! \param[out] pdbname Name of the pdb file. | 102 //! \param[out] pdbname Name of the pdb file. |
103 //! \return `true` on success, or `false` if the module has no debug directory | 103 //! \return `true` on success, or `false` if the module has no debug directory |
104 //! entry. | 104 //! entry. |
105 bool DebugDirectoryInformation(UUID* uuid, | 105 bool DebugDirectoryInformation(UUID* uuid, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 CheckedWinAddressRange module_range_; | 137 CheckedWinAddressRange module_range_; |
138 std::string module_name_; | 138 std::string module_name_; |
139 InitializationStateDcheck initialized_; | 139 InitializationStateDcheck initialized_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(PEImageReader); | 141 DISALLOW_COPY_AND_ASSIGN(PEImageReader); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace crashpad | 144 } // namespace crashpad |
145 | 145 |
146 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ | 146 #endif // CRASHPAD_SNAPSHOT_WIN_PE_IMAGE_READER_H_ |
OLD | NEW |