OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #include "snapshot/win/thread_snapshot_win.h" |
| 16 |
| 17 #include "base/logging.h" |
| 18 #include "snapshot/win/process_reader_win.h" |
| 19 |
| 20 namespace crashpad { |
| 21 namespace internal { |
| 22 |
| 23 ThreadSnapshotWin::ThreadSnapshotWin() |
| 24 : ThreadSnapshot(), context_(), stack_(), thread_(), initialized_() { |
| 25 } |
| 26 |
| 27 ThreadSnapshotWin::~ThreadSnapshotWin() { |
| 28 } |
| 29 |
| 30 bool ThreadSnapshotWin::Initialize( |
| 31 ProcessReaderWin* process_reader, |
| 32 const ProcessReaderWin::Thread& process_reader_thread) { |
| 33 INITIALIZATION_STATE_SET_INITIALIZING(initialized_); |
| 34 |
| 35 thread_ = process_reader_thread; |
| 36 stack_.Initialize( |
| 37 process_reader, thread_.stack_region_address, thread_.stack_region_size); |
| 38 |
| 39 INITIALIZATION_STATE_SET_VALID(initialized_); |
| 40 return true; |
| 41 } |
| 42 |
| 43 const CPUContext* ThreadSnapshotWin::Context() const { |
| 44 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 45 LOG(ERROR) << "TODO(scottmg): CPUContext"; |
| 46 return &context_; |
| 47 } |
| 48 |
| 49 const MemorySnapshot* ThreadSnapshotWin::Stack() const { |
| 50 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 51 return &stack_; |
| 52 } |
| 53 |
| 54 uint64_t ThreadSnapshotWin::ThreadID() const { |
| 55 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 56 return thread_.id; |
| 57 } |
| 58 |
| 59 int ThreadSnapshotWin::SuspendCount() const { |
| 60 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 61 return thread_.suspend_count; |
| 62 } |
| 63 |
| 64 int ThreadSnapshotWin::Priority() const { |
| 65 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 66 return thread_.priority; |
| 67 } |
| 68 |
| 69 uint64_t ThreadSnapshotWin::ThreadSpecificDataAddress() const { |
| 70 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
| 71 return thread_.teb; |
| 72 } |
| 73 |
| 74 } // namespace internal |
| 75 } // namespace crashpad |
OLD | NEW |