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(process_reader_thread.context.wow64, context_.x86); |
49 *reinterpret_cast<const WOW64_CONTEXT*>(&process_reader_thread.context), | |
50 context_.x86); | |
51 } | 49 } |
52 #else | 50 #else |
53 context_.architecture = kCPUArchitectureX86; | 51 context_.architecture = kCPUArchitectureX86; |
54 context_.x86 = &context_union_.x86; | 52 context_.x86 = &context_union_.x86; |
55 InitializeX86Context( | 53 InitializeX86Context(process_reader_thread.context.native, context_.x86); |
56 *reinterpret_cast<const CONTEXT*>(&process_reader_thread.context), | |
57 context_.x86); | |
58 #endif // ARCH_CPU_X86_64 | 54 #endif // ARCH_CPU_X86_64 |
59 | 55 |
60 INITIALIZATION_STATE_SET_VALID(initialized_); | 56 INITIALIZATION_STATE_SET_VALID(initialized_); |
61 return true; | 57 return true; |
62 } | 58 } |
63 | 59 |
64 const CPUContext* ThreadSnapshotWin::Context() const { | 60 const CPUContext* ThreadSnapshotWin::Context() const { |
65 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 61 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
66 return &context_; | 62 return &context_; |
67 } | 63 } |
(...skipping 18 matching lines...) Expand all Loading... |
86 return thread_.priority; | 82 return thread_.priority; |
87 } | 83 } |
88 | 84 |
89 uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const { | 85 uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const { |
90 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 86 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
91 return thread_.teb; | 87 return thread_.teb; |
92 } | 88 } |
93 | 89 |
94 } // namespace internal | 90 } // namespace internal |
95 } // namespace crashpad | 91 } // namespace crashpad |
OLD | NEW |