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 22 matching lines...) Expand all Loading... |
33 thread_(), | 33 thread_(), |
34 initialized_() { | 34 initialized_() { |
35 } | 35 } |
36 | 36 |
37 ThreadSnapshotWin::~ThreadSnapshotWin() { | 37 ThreadSnapshotWin::~ThreadSnapshotWin() { |
38 } | 38 } |
39 | 39 |
40 bool ThreadSnapshotWin::Initialize( | 40 bool ThreadSnapshotWin::Initialize( |
41 ProcessReaderWin* process_reader, | 41 ProcessReaderWin* process_reader, |
42 const ProcessReaderWin::Thread& process_reader_thread, | 42 const ProcessReaderWin::Thread& process_reader_thread, |
43 bool gather_indirectly_referenced_memory) { | 43 uint32_t* gather_indirectly_referenced_memory_bytes_remaining) { |
44 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); | 44 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); |
45 | 45 |
46 thread_ = process_reader_thread; | 46 thread_ = process_reader_thread; |
47 if (process_reader->GetProcessInfo().LoggingRangeIsFullyReadable( | 47 if (process_reader->GetProcessInfo().LoggingRangeIsFullyReadable( |
48 CheckedRange<WinVMAddress, WinVMSize>(thread_.stack_region_address, | 48 CheckedRange<WinVMAddress, WinVMSize>(thread_.stack_region_address, |
49 thread_.stack_region_size))) { | 49 thread_.stack_region_size))) { |
50 stack_.Initialize(process_reader, | 50 stack_.Initialize(process_reader, |
51 thread_.stack_region_address, | 51 thread_.stack_region_address, |
52 thread_.stack_region_size); | 52 thread_.stack_region_size); |
53 } else { | 53 } else { |
(...skipping 18 matching lines...) Expand all Loading... |
72 context_.x86 = &context_union_.x86; | 72 context_.x86 = &context_union_.x86; |
73 InitializeX86Context(process_reader_thread.context.wow64, context_.x86); | 73 InitializeX86Context(process_reader_thread.context.wow64, context_.x86); |
74 } | 74 } |
75 #else | 75 #else |
76 context_.architecture = kCPUArchitectureX86; | 76 context_.architecture = kCPUArchitectureX86; |
77 context_.x86 = &context_union_.x86; | 77 context_.x86 = &context_union_.x86; |
78 InitializeX86Context(process_reader_thread.context.native, context_.x86); | 78 InitializeX86Context(process_reader_thread.context.native, context_.x86); |
79 #endif // ARCH_CPU_X86_64 | 79 #endif // ARCH_CPU_X86_64 |
80 | 80 |
81 CaptureMemoryDelegateWin capture_memory_delegate( | 81 CaptureMemoryDelegateWin capture_memory_delegate( |
82 process_reader, thread_, &pointed_to_memory_); | 82 process_reader, |
| 83 thread_, |
| 84 &pointed_to_memory_, |
| 85 gather_indirectly_referenced_memory_bytes_remaining); |
83 CaptureMemory::PointedToByContext(context_, &capture_memory_delegate); | 86 CaptureMemory::PointedToByContext(context_, &capture_memory_delegate); |
84 if (gather_indirectly_referenced_memory) | 87 if (gather_indirectly_referenced_memory_bytes_remaining) { |
85 CaptureMemory::PointedToByMemoryRange(stack_, &capture_memory_delegate); | 88 CaptureMemory::PointedToByMemoryRange(stack_, &capture_memory_delegate); |
| 89 } |
86 | 90 |
87 INITIALIZATION_STATE_SET_VALID(initialized_); | 91 INITIALIZATION_STATE_SET_VALID(initialized_); |
88 return true; | 92 return true; |
89 } | 93 } |
90 | 94 |
91 const CPUContext* ThreadSnapshotWin::Context() const { | 95 const CPUContext* ThreadSnapshotWin::Context() const { |
92 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 96 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
93 return &context_; | 97 return &context_; |
94 } | 98 } |
95 | 99 |
(...skipping 28 matching lines...) Expand all Loading... |
124 result.reserve(1 + pointed_to_memory_.size()); | 128 result.reserve(1 + pointed_to_memory_.size()); |
125 result.push_back(&teb_); | 129 result.push_back(&teb_); |
126 std::copy(pointed_to_memory_.begin(), | 130 std::copy(pointed_to_memory_.begin(), |
127 pointed_to_memory_.end(), | 131 pointed_to_memory_.end(), |
128 std::back_inserter(result)); | 132 std::back_inserter(result)); |
129 return result; | 133 return result; |
130 } | 134 } |
131 | 135 |
132 } // namespace internal | 136 } // namespace internal |
133 } // namespace crashpad | 137 } // namespace crashpad |
OLD | NEW |