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

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

Issue 1392093003: win: Capture some CRITICAL_SECTION debugging data (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class ProcessSnapshotWin final : public ProcessSnapshot { 50 class ProcessSnapshotWin final : public ProcessSnapshot {
51 public: 51 public:
52 ProcessSnapshotWin(); 52 ProcessSnapshotWin();
53 ~ProcessSnapshotWin() override; 53 ~ProcessSnapshotWin() override;
54 54
55 //! \brief Initializes the object. 55 //! \brief Initializes the object.
56 //! 56 //!
57 //! \param[in] process The handle to create a snapshot from. 57 //! \param[in] process The handle to create a snapshot from.
58 //! \param[in] suspension_state Whether \a process has been suspended by the 58 //! \param[in] suspension_state Whether \a process has been suspended by the
59 //! caller. 59 //! caller.
60 //! \param[in] debug_critical_section_address The address in the target
61 //! process's address space of a `CRITICAL_SECTION` allocated with valid
62 //! .DebugInfo. Used as a starting point to walk the process's locks.
63 //! May be `0`.
60 //! 64 //!
61 //! \return `true` if the snapshot could be created, `false` otherwise with 65 //! \return `true` if the snapshot could be created, `false` otherwise with
62 //! an appropriate message logged. 66 //! an appropriate message logged.
63 //! 67 //!
64 //! \sa ScopedProcessSuspend 68 //! \sa ScopedProcessSuspend
65 bool Initialize(HANDLE process, ProcessSuspensionState suspension_state); 69 bool Initialize(HANDLE process,
70 ProcessSuspensionState suspension_state,
71 WinVMAddress debug_critical_section_address);
66 72
67 //! \brief Initializes the object's exception. 73 //! \brief Initializes the object's exception.
68 //! 74 //!
69 //! This populates the data to be returned by Exception(). 75 //! This populates the data to be returned by Exception().
70 //! 76 //!
71 //! This method must not be called until after a successful call to 77 //! This method must not be called until after a successful call to
72 //! Initialize(). 78 //! Initialize().
73 //! 79 //!
74 //! \param[in] exception_information_address The address in the client 80 //! \param[in] exception_information_address The address in the client
75 //! process's address space of an ExceptionInformation structure. 81 //! process's address space of an ExceptionInformation structure.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const ExceptionSnapshot* Exception() const override; 134 const ExceptionSnapshot* Exception() const override;
129 std::vector<const MemorySnapshot*> ExtraMemory() const override; 135 std::vector<const MemorySnapshot*> ExtraMemory() const override;
130 136
131 private: 137 private:
132 // Initializes threads_ on behalf of Initialize(). 138 // Initializes threads_ on behalf of Initialize().
133 void InitializeThreads(); 139 void InitializeThreads();
134 140
135 // Initializes modules_ on behalf of Initialize(). 141 // Initializes modules_ on behalf of Initialize().
136 void InitializeModules(); 142 void InitializeModules();
137 143
138 // Initializes peb_memory_ on behalf of Initialize(). 144 // Initializes various memory blocks reachable from the PEB on behalf of
145 // Initialize().
139 template <class Traits> 146 template <class Traits>
140 void InitializePebData(); 147 void InitializePebData(WinVMAddress debug_critical_section_address);
141 148
142 void AddMemorySnapshot(WinVMAddress address, 149 void AddMemorySnapshot(WinVMAddress address,
143 WinVMSize size, 150 WinVMSize size,
144 PointerVector<internal::MemorySnapshotWin>* into); 151 PointerVector<internal::MemorySnapshotWin>* into);
145 152
146 template <class Traits> 153 template <class Traits>
147 void AddMemorySnapshotForUNICODE_STRING( 154 void AddMemorySnapshotForUNICODE_STRING(
148 const process_types::UNICODE_STRING<Traits>& us, 155 const process_types::UNICODE_STRING<Traits>& us,
149 PointerVector<internal::MemorySnapshotWin>* into); 156 PointerVector<internal::MemorySnapshotWin>* into);
150 157
151 template <class Traits> 158 template <class Traits>
152 void AddMemorySnapshotForLdrLIST_ENTRY( 159 void AddMemorySnapshotForLdrLIST_ENTRY(
153 const process_types::LIST_ENTRY<Traits>& le, 160 const process_types::LIST_ENTRY<Traits>& le,
154 size_t offset_of_member, 161 size_t offset_of_member,
155 PointerVector<internal::MemorySnapshotWin>* into); 162 PointerVector<internal::MemorySnapshotWin>* into);
156 163
157 WinVMSize DetermineSizeOfEnvironmentBlock( 164 WinVMSize DetermineSizeOfEnvironmentBlock(
158 WinVMAddress start_of_environment_block); 165 WinVMAddress start_of_environment_block);
159 166
167 // Starting from the address of a CRITICAL_SECTION, walks the doubly-linked
168 // list stored in RTL_CRITICAL_SECTION.DebugInfo.ProcessLocksList adding both
169 // the RTL_CRITICAL_SECTION and the RTL_CRITICAL_SECTION_DEBUG memory blocks
170 // to the snapshot.
171 template <class Traits>
172 void ReadLocks(WinVMAddress start,
173 PointerVector<internal::MemorySnapshotWin>* into);
174
160 internal::SystemSnapshotWin system_; 175 internal::SystemSnapshotWin system_;
161 PointerVector<internal::MemorySnapshotWin> peb_memory_; 176 PointerVector<internal::MemorySnapshotWin> extra_memory_;
162 PointerVector<internal::ThreadSnapshotWin> threads_; 177 PointerVector<internal::ThreadSnapshotWin> threads_;
163 PointerVector<internal::ModuleSnapshotWin> modules_; 178 PointerVector<internal::ModuleSnapshotWin> modules_;
164 scoped_ptr<internal::ExceptionSnapshotWin> exception_; 179 scoped_ptr<internal::ExceptionSnapshotWin> exception_;
165 ProcessReaderWin process_reader_; 180 ProcessReaderWin process_reader_;
166 UUID report_id_; 181 UUID report_id_;
167 UUID client_id_; 182 UUID client_id_;
168 std::map<std::string, std::string> annotations_simple_map_; 183 std::map<std::string, std::string> annotations_simple_map_;
169 timeval snapshot_time_; 184 timeval snapshot_time_;
170 InitializationStateDcheck initialized_; 185 InitializationStateDcheck initialized_;
171 186
172 DISALLOW_COPY_AND_ASSIGN(ProcessSnapshotWin); 187 DISALLOW_COPY_AND_ASSIGN(ProcessSnapshotWin);
173 }; 188 };
174 189
175 } // namespace crashpad 190 } // namespace crashpad
176 191
177 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_SNAPSHOT_WIN_H_ 192 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_SNAPSHOT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698