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_PROCESS_READER_WIN_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
16 #define CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 16 #define CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
17 | 17 |
18 #include <sys/time.h> | 18 #include <sys/time.h> |
19 #include <windows.h> | 19 #include <windows.h> |
20 | 20 |
21 #include <vector> | 21 #include <vector> |
22 | 22 |
23 #include "util/misc/initialization_state_dcheck.h" | 23 #include "util/misc/initialization_state_dcheck.h" |
24 #include "util/win/address_types.h" | 24 #include "util/win/address_types.h" |
25 #include "util/win/process_info.h" | 25 #include "util/win/process_info.h" |
26 | 26 |
27 namespace crashpad { | 27 namespace crashpad { |
28 | 28 |
29 //! \brief Accesses information about another process, identified by a HANDLE. | 29 //! \brief Accesses information about another process, identified by a `HANDLE`. |
30 class ProcessReaderWin { | 30 class ProcessReaderWin { |
31 public: | 31 public: |
32 //! \brief Contains information about a thread that belongs to a process. | 32 //! \brief Contains information about a thread that belongs to a process. |
33 struct Thread { | 33 struct Thread { |
34 Thread(); | 34 Thread(); |
35 ~Thread() {} | 35 ~Thread() {} |
36 | 36 |
37 CONTEXT context; | 37 CONTEXT context; |
38 uint64_t id; | 38 uint64_t id; |
39 WinVMAddress teb; | 39 WinVMAddress teb; |
40 WinVMAddress stack_region_address; | 40 WinVMAddress stack_region_address; |
41 WinVMSize stack_region_size; | 41 WinVMSize stack_region_size; |
42 uint32_t suspend_count; | 42 uint32_t suspend_count; |
43 uint32_t priority_class; | 43 uint32_t priority_class; |
44 uint32_t priority; | 44 uint32_t priority; |
45 }; | 45 }; |
46 | 46 |
47 ProcessReaderWin(); | 47 ProcessReaderWin(); |
48 ~ProcessReaderWin(); | 48 ~ProcessReaderWin(); |
49 | 49 |
50 //! \brief Initializes this object. This method must be called before any | 50 //! \brief Initializes this object. This method must be called before any |
51 //! other. | 51 //! other. |
52 //! | 52 //! |
53 //! \param[in] process Process handle, must have PROCESS_QUERY_INFORMATION, | 53 //! \param[in] process Process handle, must have `PROCESS_QUERY_INFORMATION`, |
54 //! PROCESS_VM_READ, and PROCESS_DUP_HANDLE access. | 54 //! `PROCESS_VM_READ`, and `PROCESS_DUP_HANDLE` access. |
55 //! | 55 //! |
56 //! \return `true` on success, indicating that this object will respond | 56 //! \return `true` on success, indicating that this object will respond |
57 //! validly to further method calls. `false` on failure. On failure, no | 57 //! validly to further method calls. `false` on failure. On failure, no |
58 //! further method calls should be made. | 58 //! further method calls should be made. |
59 bool Initialize(HANDLE process); | 59 bool Initialize(HANDLE process); |
60 | 60 |
61 //! \return `true` if the target task is a 64-bit process. | 61 //! \return `true` if the target task is a 64-bit process. |
62 bool Is64Bit() const { return process_info_.Is64Bit(); } | 62 bool Is64Bit() const { return process_info_.Is64Bit(); } |
63 | 63 |
64 pid_t ProcessID() const { return process_info_.ProcessID(); } | 64 pid_t ProcessID() const { return process_info_.ProcessID(); } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 std::vector<ProcessInfo::Module> modules_; | 98 std::vector<ProcessInfo::Module> modules_; |
99 bool initialized_threads_; | 99 bool initialized_threads_; |
100 InitializationStateDcheck initialized_; | 100 InitializationStateDcheck initialized_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); | 102 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace crashpad | 105 } // namespace crashpad |
106 | 106 |
107 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 107 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
OLD | NEW |