Chromium Code Reviews| 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 <windows.h> | 19 #include <windows.h> |
| 19 | 20 |
| 20 #include "util/misc/initialization_state_dcheck.h" | 21 #include "util/misc/initialization_state_dcheck.h" |
| 21 #include "util/win/address_types.h" | 22 #include "util/win/address_types.h" |
| 22 #include "util/win/process_info.h" | 23 #include "util/win/process_info.h" |
| 23 | 24 |
| 24 namespace crashpad { | 25 namespace crashpad { |
| 25 | 26 |
| 26 //! \brief Accesses information about another process, identified by a HANDLE. | 27 //! \brief Accesses information about another process, identified by a HANDLE. |
| 27 class ProcessReaderWin { | 28 class ProcessReaderWin { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 41 bool Initialize(HANDLE process); | 42 bool Initialize(HANDLE process); |
| 42 | 43 |
| 43 //! \return `true` if the target task is a 64-bit process. | 44 //! \return `true` if the target task is a 64-bit process. |
| 44 bool Is64Bit() const { return process_info_.Is64Bit(); } | 45 bool Is64Bit() const { return process_info_.Is64Bit(); } |
| 45 | 46 |
| 46 pid_t ProcessID() const { return process_info_.ProcessID(); } | 47 pid_t ProcessID() const { return process_info_.ProcessID(); } |
| 47 pid_t ParentProcessID() const { return process_info_.ParentProcessID(); } | 48 pid_t ParentProcessID() const { return process_info_.ParentProcessID(); } |
| 48 | 49 |
| 49 bool ReadMemory(WinVMAddress at, WinVMSize num_bytes, void* into); | 50 bool ReadMemory(WinVMAddress at, WinVMSize num_bytes, void* into); |
| 50 | 51 |
| 52 //! \brief Determines the target process' start time. | |
| 53 //! | |
| 54 //! \param[out] start_time The time that the process started. | |
| 55 //! | |
| 56 //! \return `true` on success, `false` on failure, with a warning logged. On | |
| 57 //! failure, \a start_time will be set to represent the epoch. | |
|
Mark Mentovai
2015/05/04 21:29:23
It’s OK to leave start_time undefined as far as th
scottmg
2015/05/05 16:45:48
Done.
| |
| 58 bool StartTime(timeval* start_time) const; | |
| 59 | |
| 60 //! \brief Determines the target process' execution time. | |
| 61 //! | |
| 62 //! \param[out] user_time The amount of time the process has executed code in | |
| 63 //! user mode. | |
| 64 //! \param[out] system_time The amount of time the process has executed code | |
| 65 //! in kernel mode. | |
| 66 //! | |
| 67 //! \return `true` on success, `false` on failure, with a warning logged. On | |
| 68 //! failure, \a user_time and \a system_time will be set to represent no | |
| 69 //! time spent executing code in user or kernel mode. | |
| 70 bool CPUTimes(timeval* user_time, timeval* system_time) const; | |
| 71 | |
| 51 //! \return The modules loaded in the process. The first element (at index | 72 //! \return The modules loaded in the process. The first element (at index |
| 52 //! `0`) corresponds to the main executable. | 73 //! `0`) corresponds to the main executable. |
| 53 const std::vector<ProcessInfo::Module>& Modules(); | 74 const std::vector<ProcessInfo::Module>& Modules(); |
| 54 | 75 |
| 55 private: | 76 private: |
| 56 HANDLE process_; | 77 HANDLE process_; |
| 57 ProcessInfo process_info_; | 78 ProcessInfo process_info_; |
| 58 std::vector<ProcessInfo::Module> modules_; | 79 std::vector<ProcessInfo::Module> modules_; |
| 59 InitializationStateDcheck initialized_; | 80 InitializationStateDcheck initialized_; |
| 60 | 81 |
| 61 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); | 82 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); |
| 62 }; | 83 }; |
| 63 | 84 |
| 64 } // namespace crashpad | 85 } // namespace crashpad |
| 65 | 86 |
| 66 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ | 87 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ |
| OLD | NEW |