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