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

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

Issue 1349313003: win: support x64 reading x86 (wow64) (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 3 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 <vector> 21 #include <vector>
22 22
23 #include "build/build_config.h"
23 #include "util/misc/initialization_state_dcheck.h" 24 #include "util/misc/initialization_state_dcheck.h"
24 #include "util/win/address_types.h" 25 #include "util/win/address_types.h"
25 #include "util/win/process_info.h" 26 #include "util/win/process_info.h"
26 27
27 namespace crashpad { 28 namespace crashpad {
28 29
29 //! \brief State of process being read by ProcessReaderWin. 30 //! \brief State of process being read by ProcessReaderWin.
30 enum class ProcessSuspensionState : bool { 31 enum class ProcessSuspensionState : bool {
31 //! \brief The process has not been suspended. 32 //! \brief The process has not been suspended.
32 kRunning, 33 kRunning,
33 34
34 //! \brief The process is suspended. 35 //! \brief The process is suspended.
35 kSuspended, 36 kSuspended,
36 }; 37 };
37 38
38 //! \brief Accesses information about another process, identified by a `HANDLE`. 39 //! \brief Accesses information about another process, identified by a `HANDLE`.
39 class ProcessReaderWin { 40 class ProcessReaderWin {
40 public: 41 public:
41 //! \brief Contains information about a thread that belongs to a process. 42 //! \brief Contains information about a thread that belongs to a process.
42 struct Thread { 43 struct Thread {
43 Thread(); 44 Thread();
44 ~Thread() {} 45 ~Thread() {}
45 46
46 CONTEXT context; 47 #if defined(ARCH_CPU_64_BITS)
48 union {
49 CONTEXT context_native;
50 WOW64_CONTEXT context_wow64;
51 };
52 #else
53 CONTEXT context_native;
Mark Mentovai 2015/09/18 15:44:07 Fix indentation.
scottmg 2015/09/18 19:45:26 Done.
54 #endif // ARCH_CPU_64_BITS
47 uint64_t id; 55 uint64_t id;
48 WinVMAddress teb; 56 WinVMAddress teb;
49 WinVMAddress stack_region_address; 57 WinVMAddress stack_region_address;
50 WinVMSize stack_region_size; 58 WinVMSize stack_region_size;
51 uint32_t suspend_count; 59 uint32_t suspend_count;
52 uint32_t priority_class; 60 uint32_t priority_class;
53 uint32_t priority; 61 uint32_t priority;
54 }; 62 };
55 63
56 ProcessReaderWin(); 64 ProcessReaderWin();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 //! \return The threads that are in the process. The first element (at index 109 //! \return The threads that are in the process. The first element (at index
102 //! `0`) corresponds to the main thread. 110 //! `0`) corresponds to the main thread.
103 const std::vector<Thread>& Threads(); 111 const std::vector<Thread>& Threads();
104 112
105 //! \return The modules loaded in the process. The first element (at index 113 //! \return The modules loaded in the process. The first element (at index
106 //! `0`) corresponds to the main executable. 114 //! `0`) corresponds to the main executable.
107 const std::vector<ProcessInfo::Module>& Modules(); 115 const std::vector<ProcessInfo::Module>& Modules();
108 116
109 private: 117 private:
110 template <class Traits> 118 template <class Traits>
111 void ReadThreadData(); 119 void ReadThreadData(bool is_wow64);
112 120
113 HANDLE process_; 121 HANDLE process_;
114 ProcessInfo process_info_; 122 ProcessInfo process_info_;
115 std::vector<Thread> threads_; 123 std::vector<Thread> threads_;
116 std::vector<ProcessInfo::Module> modules_; 124 std::vector<ProcessInfo::Module> modules_;
117 ProcessSuspensionState suspension_state_; 125 ProcessSuspensionState suspension_state_;
118 bool initialized_threads_; 126 bool initialized_threads_;
119 InitializationStateDcheck initialized_; 127 InitializationStateDcheck initialized_;
120 128
121 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin); 129 DISALLOW_COPY_AND_ASSIGN(ProcessReaderWin);
122 }; 130 };
123 131
124 } // namespace crashpad 132 } // namespace crashpad
125 133
126 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_ 134 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_READER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698