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, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 //! \return `true` on success, indicating that this object will respond | 79 //! \return `true` on success, indicating that this object will respond |
80 //! validly to further method calls. `false` on failure. On failure, no | 80 //! validly to further method calls. `false` on failure. On failure, no |
81 //! further method calls should be made. | 81 //! further method calls should be made. |
82 //! | 82 //! |
83 //! \sa ScopedProcessSuspend | 83 //! \sa ScopedProcessSuspend |
84 bool Initialize(HANDLE process, ProcessSuspensionState suspension_state); | 84 bool Initialize(HANDLE process, ProcessSuspensionState suspension_state); |
85 | 85 |
86 //! \return `true` if the target task is a 64-bit process. | 86 //! \return `true` if the target task is a 64-bit process. |
87 bool Is64Bit() const { return process_info_.Is64Bit(); } | 87 bool Is64Bit() const { return process_info_.Is64Bit(); } |
88 | 88 |
89 pid_t ProcessID() const { return process_info_.ProcessID(); } | |
90 pid_t ParentProcessID() const { return process_info_.ParentProcessID(); } | |
91 | |
92 bool ReadMemory(WinVMAddress at, WinVMSize num_bytes, void* into) const; | 89 bool ReadMemory(WinVMAddress at, WinVMSize num_bytes, void* into) const; |
93 | 90 |
94 //! \brief Determines the target process' start time. | 91 //! \brief Determines the target process' start time. |
95 //! | 92 //! |
96 //! \param[out] start_time The time that the process started. | 93 //! \param[out] start_time The time that the process started. |
97 //! | 94 //! |
98 //! \return `true` on success, `false` on failure, with a warning logged. | 95 //! \return `true` on success, `false` on failure, with a warning logged. |
99 bool StartTime(timeval* start_time) const; | 96 bool StartTime(timeval* start_time) const; |
100 | 97 |
101 //! \brief Determines the target process' execution time. | 98 //! \brief Determines the target process' execution time. |
102 //! | 99 //! |
103 //! \param[out] user_time The amount of time the process has executed code in | 100 //! \param[out] user_time The amount of time the process has executed code in |
104 //! user mode. | 101 //! user mode. |
105 //! \param[out] system_time The amount of time the process has executed code | 102 //! \param[out] system_time The amount of time the process has executed code |
106 //! in kernel mode. | 103 //! in kernel mode. |
107 //! | 104 //! |
108 //! \return `true` on success, `false` on failure, with a warning logged. | 105 //! \return `true` on success, `false` on failure, with a warning logged. |
109 bool CPUTimes(timeval* user_time, timeval* system_time) const; | 106 bool CPUTimes(timeval* user_time, timeval* system_time) const; |
110 | 107 |
111 //! \return The threads that are in the process. The first element (at index | 108 //! \return The threads that are in the process. The first element (at index |
112 //! `0`) corresponds to the main thread. | 109 //! `0`) corresponds to the main thread. |
113 const std::vector<Thread>& Threads(); | 110 const std::vector<Thread>& Threads(); |
114 | 111 |
115 //! \return The modules loaded in the process. The first element (at index | 112 //! \return The modules loaded in the process. The first element (at index |
116 //! `0`) corresponds to the main executable. | 113 //! `0`) corresponds to the main executable. |
117 const std::vector<ProcessInfo::Module>& Modules(); | 114 const std::vector<ProcessInfo::Module>& Modules(); |
118 | 115 |
| 116 //! \return A ProcessInfo object for the process being read. |
| 117 const ProcessInfo& GetProcessInfo() const; |
| 118 |
119 private: | 119 private: |
120 template <class Traits> | 120 template <class Traits> |
121 void ReadThreadData(bool is_64_reading_32); | 121 void ReadThreadData(bool is_64_reading_32); |
122 | 122 |
123 HANDLE process_; | 123 HANDLE process_; |
124 ProcessInfo process_info_; | 124 ProcessInfo process_info_; |
125 std::vector<Thread> threads_; | 125 std::vector<Thread> threads_; |
126 std::vector<ProcessInfo::Module> modules_; | 126 std::vector<ProcessInfo::Module> modules_; |
127 ProcessSuspensionState suspension_state_; | 127 ProcessSuspensionState suspension_state_; |
128 bool initialized_threads_; | 128 bool initialized_threads_; |
129 InitializationStateDcheck initialized_; | 129 InitializationStateDcheck initialized_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); | 131 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); |
132 }; | 132 }; |
133 | 133 |
134 } // namespace crashpad | 134 } // namespace crashpad |
135 | 135 |
136 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 136 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
OLD | NEW |