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

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: . 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
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 "util/misc/initialization_state_dcheck.h" 21 #include "util/misc/initialization_state_dcheck.h"
22 #include "util/win/address_types.h" 22 #include "util/win/address_types.h"
23 #include "util/win/process_info.h" 23 #include "util/win/process_info.h"
24 24
25 namespace crashpad { 25 namespace crashpad {
26 26
27 //! \brief Accesses information about another process, identified by a HANDLE. 27 //! \brief Accesses information about another process, identified by a HANDLE.
28 class ProcessReaderWin { 28 class ProcessReaderWin {
29 public: 29 public:
30 //! \brief Contains information about a thread that belongs to a process.
31 struct Thread {
32 Thread();
33 ~Thread() {}
34
35 uint64_t id;
36 uint32_t suspend_count;
37 uint32_t priority_class;
38 uint32_t priority;
39 WinVMAddress teb;
Mark Mentovai 2015/05/08 16:54:20 Reorder this for better packing: put the uint32s a
scottmg 2015/05/08 18:24:02 Done.
40 WinVMAddress stack_region_address;
41 WinVMSize stack_region_size;
42 };
43
30 ProcessReaderWin(); 44 ProcessReaderWin();
31 ~ProcessReaderWin(); 45 ~ProcessReaderWin();
32 46
33 //! \brief Initializes this object. This method must be called before any 47 //! \brief Initializes this object. This method must be called before any
34 //! other. 48 //! other.
35 //! 49 //!
36 //! \param[in] process Process handle, must have PROCESS_QUERY_INFORMATION, 50 //! \param[in] process Process handle, must have PROCESS_QUERY_INFORMATION,
37 //! PROCESS_VM_READ, and PROCESS_DUP_HANDLE access. 51 //! PROCESS_VM_READ, and PROCESS_DUP_HANDLE access.
38 //! 52 //!
39 //! \return `true` on success, indicating that this object will respond 53 //! \return `true` on success, indicating that this object will respond
(...skipping 19 matching lines...) Expand all
59 //! \brief Determines the target process' execution time. 73 //! \brief Determines the target process' execution time.
60 //! 74 //!
61 //! \param[out] user_time The amount of time the process has executed code in 75 //! \param[out] user_time The amount of time the process has executed code in
62 //! user mode. 76 //! user mode.
63 //! \param[out] system_time The amount of time the process has executed code 77 //! \param[out] system_time The amount of time the process has executed code
64 //! in kernel mode. 78 //! in kernel mode.
65 //! 79 //!
66 //! \return `true` on success, `false` on failure, with a warning logged. 80 //! \return `true` on success, `false` on failure, with a warning logged.
67 bool CPUTimes(timeval* user_time, timeval* system_time) const; 81 bool CPUTimes(timeval* user_time, timeval* system_time) const;
68 82
83 //! \return The threads that are in the process. The first element (at index
84 //! `0`) corresponds to the main thread.
85 const std::vector<Thread>& Threads();
Mark Mentovai 2015/05/08 16:54:20 #include <vector>
scottmg 2015/05/08 18:24:02 Done.
86
69 //! \return The modules loaded in the process. The first element (at index 87 //! \return The modules loaded in the process. The first element (at index
70 //! `0`) corresponds to the main executable. 88 //! `0`) corresponds to the main executable.
71 const std::vector<ProcessInfo::Module>& Modules(); 89 const std::vector<ProcessInfo::Module>& Modules();
72 90
73 private: 91 private:
92 //! Initializes the threads_ vector on behalf of Initialize().
Mark Mentovai 2015/05/08 16:54:20 This should be // or //! \brief. (But note that al
scottmg 2015/05/08 18:24:02 Done. Then removed.
93 void InitializeThreads();
94
74 HANDLE process_; 95 HANDLE process_;
75 ProcessInfo process_info_; 96 ProcessInfo process_info_;
97 std::vector<Thread> threads_;
76 std::vector<ProcessInfo::Module> modules_; 98 std::vector<ProcessInfo::Module> modules_;
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

Powered by Google App Engine
This is Rietveld 408576698