1 // Copyright 2018 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/sanitized/thread_snapshot_sanitized.h"
16 
17 #include "snapshot/cpu_context.h"
18 
19 namespace crashpad {
20 namespace internal {
21 
ThreadSnapshotSanitized(const ThreadSnapshot * snapshot,RangeSet * ranges)22 ThreadSnapshotSanitized::ThreadSnapshotSanitized(const ThreadSnapshot* snapshot,
23                                                  RangeSet* ranges)
24     : ThreadSnapshot(),
25       snapshot_(snapshot),
26       stack_(snapshot_->Stack(), ranges, snapshot_->Context()->Is64Bit()) {}
27 
28 ThreadSnapshotSanitized::~ThreadSnapshotSanitized() = default;
29 
Context() const30 const CPUContext* ThreadSnapshotSanitized::Context() const {
31   return snapshot_->Context();
32 }
33 
Stack() const34 const MemorySnapshot* ThreadSnapshotSanitized::Stack() const {
35   return &stack_;
36 }
37 
ThreadID() const38 uint64_t ThreadSnapshotSanitized::ThreadID() const {
39   return snapshot_->ThreadID();
40 }
41 
SuspendCount() const42 int ThreadSnapshotSanitized::SuspendCount() const {
43   return snapshot_->SuspendCount();
44 }
45 
Priority() const46 int ThreadSnapshotSanitized::Priority() const {
47   return snapshot_->Priority();
48 }
49 
ThreadSpecificDataAddress() const50 uint64_t ThreadSnapshotSanitized::ThreadSpecificDataAddress() const {
51   return snapshot_->ThreadSpecificDataAddress();
52 }
53 
ExtraMemory() const54 std::vector<const MemorySnapshot*> ThreadSnapshotSanitized::ExtraMemory()
55     const {
56   // TODO(jperaza): If/when ExtraMemory() is used, decide whether and how it
57   // should be sanitized.
58   DCHECK(snapshot_->ExtraMemory().empty());
59   return std::vector<const MemorySnapshot*>();
60 }
61 
62 }  // namespace internal
63 }  // namespace crashpad
64