OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); | 34 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); |
35 | 35 |
36 thread_ = process_reader_thread; | 36 thread_ = process_reader_thread; |
37 stack_.Initialize( | 37 stack_.Initialize( |
38 process_reader, thread_.stack_region_address, thread_.stack_region_size); | 38 process_reader, thread_.stack_region_address, thread_.stack_region_size); |
39 | 39 |
40 #if defined(ARCH_CPU_X86_64) | 40 #if defined(ARCH_CPU_X86_64) |
41 if (process_reader->Is64Bit()) { | 41 if (process_reader->Is64Bit()) { |
42 context_.architecture = kCPUArchitectureX86_64; | 42 context_.architecture = kCPUArchitectureX86_64; |
43 context_.x86_64 = &context_union_.x86_64; | 43 context_.x86_64 = &context_union_.x86_64; |
44 InitializeX64Context(process_reader_thread.context, context_.x86_64); | 44 InitializeX64Context(process_reader_thread.context_native, context_.x86_64); |
45 } else { | 45 } else { |
46 context_.architecture = kCPUArchitectureX86; | 46 context_.architecture = kCPUArchitectureX86; |
47 context_.x86 = &context_union_.x86; | 47 context_.x86 = &context_union_.x86; |
48 InitializeX86Context( | 48 InitializeX86Context(*reinterpret_cast<const WOW64_CONTEXT*>( |
49 *reinterpret_cast<const WOW64_CONTEXT*>(&process_reader_thread.context), | 49 &process_reader_thread.context_wow64), |
50 context_.x86); | 50 context_.x86); |
51 } | 51 } |
52 #else | 52 #else |
53 context_.architecture = kCPUArchitectureX86; | 53 context_.architecture = kCPUArchitectureX86; |
54 context_.x86 = &context_union_.x86; | 54 context_.x86 = &context_union_.x86; |
55 InitializeX86Context( | 55 InitializeX86Context( |
56 *reinterpret_cast<const CONTEXT*>(&process_reader_thread.context), | 56 *reinterpret_cast<const CONTEXT*>(&process_reader_thread.context_native), |
57 context_.x86); | 57 context_.x86); |
58 #endif // ARCH_CPU_X86_64 | 58 #endif // ARCH_CPU_X86_64 |
59 | 59 |
60 INITIALIZATION_STATE_SET_VALID(initialized_); | 60 INITIALIZATION_STATE_SET_VALID(initialized_); |
61 return true; | 61 return true; |
62 } | 62 } |
63 | 63 |
64 const CPUContext* ThreadSnapshotWin::Context() const { | 64 const CPUContext* ThreadSnapshotWin::Context() const { |
65 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 65 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
66 return &context_; | 66 return &context_; |
(...skipping 19 matching lines...) Expand all Loading... |
86 return thread_.priority; | 86 return thread_.priority; |
87 } | 87 } |
88 | 88 |
89 uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const { | 89 uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const { |
90 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 90 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
91 return thread_.teb; | 91 return thread_.teb; |
92 } | 92 } |
93 | 93 |
94 } // namespace internal | 94 } // namespace internal |
95 } // namespace crashpad | 95 } // namespace crashpad |
OLD | NEW |