Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: snapshot/win/process_reader_win.h

Issue 1131473005: win: Add thread snapshot and memory snapshot for stacks (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: comment Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/memory_snapshot_win.cc ('k') | snapshot/win/process_reader_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
22
21 #include "util/misc/initialization_state_dcheck.h" 23 #include "util/misc/initialization_state_dcheck.h"
22 #include "util/win/address_types.h" 24 #include "util/win/address_types.h"
23 #include "util/win/process_info.h" 25 #include "util/win/process_info.h"
24 26
25 namespace crashpad { 27 namespace crashpad {
26 28
27 //! \brief Accesses information about another process, identified by a HANDLE. 29 //! \brief Accesses information about another process, identified by a HANDLE.
28 class ProcessReaderWin { 30 class ProcessReaderWin {
29 public: 31 public:
32 //! \brief Contains information about a thread that belongs to a process.
33 struct Thread {
34 Thread();
35 ~Thread() {}
36
37 uint64_t id;
38 WinVMAddress teb;
39 WinVMAddress stack_region_address;
40 WinVMSize stack_region_size;
41 uint32_t suspend_count;
42 uint32_t priority_class;
43 uint32_t priority;
44 };
45
30 ProcessReaderWin(); 46 ProcessReaderWin();
31 ~ProcessReaderWin(); 47 ~ProcessReaderWin();
32 48
33 //! \brief Initializes this object. This method must be called before any 49 //! \brief Initializes this object. This method must be called before any
34 //! other. 50 //! other.
35 //! 51 //!
36 //! \param[in] process Process handle, must have PROCESS_QUERY_INFORMATION, 52 //! \param[in] process Process handle, must have PROCESS_QUERY_INFORMATION,
37 //! PROCESS_VM_READ, and PROCESS_DUP_HANDLE access. 53 //! PROCESS_VM_READ, and PROCESS_DUP_HANDLE access.
38 //! 54 //!
39 //! \return `true` on success, indicating that this object will respond 55 //! \return `true` on success, indicating that this object will respond
(...skipping 19 matching lines...) Expand all
59 //! \brief Determines the target process' execution time. 75 //! \brief Determines the target process' execution time.
60 //! 76 //!
61 //! \param[out] user_time The amount of time the process has executed code in 77 //! \param[out] user_time The amount of time the process has executed code in
62 //! user mode. 78 //! user mode.
63 //! \param[out] system_time The amount of time the process has executed code 79 //! \param[out] system_time The amount of time the process has executed code
64 //! in kernel mode. 80 //! in kernel mode.
65 //! 81 //!
66 //! \return `true` on success, `false` on failure, with a warning logged. 82 //! \return `true` on success, `false` on failure, with a warning logged.
67 bool CPUTimes(timeval* user_time, timeval* system_time) const; 83 bool CPUTimes(timeval* user_time, timeval* system_time) const;
68 84
85 //! \return The threads that are in the process. The first element (at index
86 //! `0`) corresponds to the main thread.
87 const std::vector<Thread>& Threads();
88
69 //! \return The modules loaded in the process. The first element (at index 89 //! \return The modules loaded in the process. The first element (at index
70 //! `0`) corresponds to the main executable. 90 //! `0`) corresponds to the main executable.
71 const std::vector<ProcessInfo::Module>& Modules(); 91 const std::vector<ProcessInfo::Module>& Modules();
72 92
73 private: 93 private:
74 HANDLE process_; 94 HANDLE process_;
75 ProcessInfo process_info_; 95 ProcessInfo process_info_;
96 std::vector<Thread> threads_;
76 std::vector<ProcessInfo::Module> modules_; 97 std::vector<ProcessInfo::Module> modules_;
98 bool initialized_threads_;
77 InitializationStateDcheck initialized_; 99 InitializationStateDcheck initialized_;
78 100
79 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); 101 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin);
80 }; 102 };
81 103
82 } // namespace crashpad 104 } // namespace crashpad
83 105
84 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ 106 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_
OLDNEW
« no previous file with comments | « snapshot/win/memory_snapshot_win.cc ('k') | snapshot/win/process_reader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698