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

Side by Side Diff: util/win/process_info.h

Issue 1407643004: Some plumbing for the beginning of getting handles into snapshot/minidump (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@handles-redux
Patch Set: . Created 5 years, 2 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/process_snapshot_win.cc ('k') | util/win/process_info.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,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 //! of ranges, representing the readable portions of the original range. 133 //! of ranges, representing the readable portions of the original range.
134 //! 134 //!
135 //! \param[in] range The range being identified. 135 //! \param[in] range The range being identified.
136 //! 136 //!
137 //! \return A vector of ranges corresponding to the portion of \a range that 137 //! \return A vector of ranges corresponding to the portion of \a range that
138 //! is readable based on the memory map. 138 //! is readable based on the memory map.
139 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRanges( 139 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRanges(
140 const CheckedRange<WinVMAddress, WinVMSize>& range) const; 140 const CheckedRange<WinVMAddress, WinVMSize>& range) const;
141 141
142 //! \brief Retrieves information about open handles in the target process. 142 //! \brief Retrieves information about open handles in the target process.
143 const std::vector<Handle>& Handles(); 143 const std::vector<Handle>& Handles() const;
144 144
145 private: 145 private:
146 template <class Traits> 146 template <class Traits>
147 friend bool GetProcessBasicInformation(HANDLE process, 147 friend bool GetProcessBasicInformation(HANDLE process,
148 bool is_wow64, 148 bool is_wow64,
149 ProcessInfo* process_info, 149 ProcessInfo* process_info,
150 WinVMAddress* peb_address, 150 WinVMAddress* peb_address,
151 WinVMSize* peb_size); 151 WinVMSize* peb_size);
152 template <class Traits> 152 template <class Traits>
153 friend bool ReadProcessData(HANDLE process, 153 friend bool ReadProcessData(HANDLE process,
154 WinVMAddress peb_address_vmaddr, 154 WinVMAddress peb_address_vmaddr,
155 ProcessInfo* process_info); 155 ProcessInfo* process_info);
156 156
157 friend bool ReadMemoryInfo(HANDLE process, 157 friend bool ReadMemoryInfo(HANDLE process,
158 bool is_64_bit, 158 bool is_64_bit,
159 ProcessInfo* process_info); 159 ProcessInfo* process_info);
160 160
161 std::vector<Handle> BuildHandleVector(HANDLE process) const; 161 std::vector<Handle> BuildHandleVector(HANDLE process) const;
162 162
163 pid_t process_id_; 163 pid_t process_id_;
164 pid_t inherited_from_process_id_; 164 pid_t inherited_from_process_id_;
165 HANDLE process_; 165 HANDLE process_;
166 std::wstring command_line_; 166 std::wstring command_line_;
167 WinVMAddress peb_address_; 167 WinVMAddress peb_address_;
168 WinVMSize peb_size_; 168 WinVMSize peb_size_;
169 std::vector<Module> modules_; 169 std::vector<Module> modules_;
170 std::vector<MEMORY_BASIC_INFORMATION64> memory_info_; 170 std::vector<MEMORY_BASIC_INFORMATION64> memory_info_;
171 std::vector<Handle> handles_; 171
172 // Handles() is logically const, but updates this member on first retrieval.
173 // See https://code.google.com/p/crashpad/issues/detail?id=9.
174 mutable std::vector<Handle> handles_;
175
172 bool is_64_bit_; 176 bool is_64_bit_;
173 bool is_wow64_; 177 bool is_wow64_;
174 InitializationStateDcheck initialized_; 178 InitializationStateDcheck initialized_;
175 179
176 DISALLOW_COPY_AND_ASSIGN(ProcessInfo); 180 DISALLOW_COPY_AND_ASSIGN(ProcessInfo);
177 }; 181 };
178 182
179 //! \brief Given a memory map of a process, and a range to be read from the 183 //! \brief Given a memory map of a process, and a range to be read from the
180 //! target process, returns a vector of ranges, representing the readable 184 //! target process, returns a vector of ranges, representing the readable
181 //! portions of the original range. 185 //! portions of the original range.
182 //! 186 //!
183 //! This is a free function for testing, but prefer 187 //! This is a free function for testing, but prefer
184 //! ProcessInfo::GetReadableRanges(). 188 //! ProcessInfo::GetReadableRanges().
185 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRangesOfMemoryMap( 189 std::vector<CheckedRange<WinVMAddress, WinVMSize>> GetReadableRangesOfMemoryMap(
186 const CheckedRange<WinVMAddress, WinVMSize>& range, 190 const CheckedRange<WinVMAddress, WinVMSize>& range,
187 const std::vector<MEMORY_BASIC_INFORMATION64>& memory_info); 191 const std::vector<MEMORY_BASIC_INFORMATION64>& memory_info);
188 192
189 } // namespace crashpad 193 } // namespace crashpad
190 194
191 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_ 195 #endif // CRASHPAD_UTIL_WIN_PROCESS_INFO_H_
OLDNEW
« no previous file with comments | « snapshot/win/process_snapshot_win.cc ('k') | util/win/process_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698