Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: snapshot/test/test_thread_snapshot.h

Issue 1364803004: win: Save contents of TEBs allowing !teb and !gle to work in windbg (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@dump-without-crashing
Patch Set: . Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/test/test_process_snapshot.h ('k') | snapshot/test/test_thread_snapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_
16 #define CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_
17 17
18 #include <stdint.h> 18 #include <stdint.h>
19 19
20 #include <vector>
21
20 #include "base/basictypes.h" 22 #include "base/basictypes.h"
21 #include "base/memory/scoped_ptr.h" 23 #include "base/memory/scoped_ptr.h"
22 #include "snapshot/cpu_context.h" 24 #include "snapshot/cpu_context.h"
23 #include "snapshot/memory_snapshot.h" 25 #include "snapshot/memory_snapshot.h"
24 #include "snapshot/thread_snapshot.h" 26 #include "snapshot/thread_snapshot.h"
27 #include "util/stdlib/pointer_container.h"
25 28
26 namespace crashpad { 29 namespace crashpad {
27 namespace test { 30 namespace test {
28 31
29 //! \brief A test ThreadSnapshot that can carry arbitrary data for testing 32 //! \brief A test ThreadSnapshot that can carry arbitrary data for testing
30 //! purposes. 33 //! purposes.
31 class TestThreadSnapshot final : public ThreadSnapshot { 34 class TestThreadSnapshot final : public ThreadSnapshot {
32 public: 35 public:
33 TestThreadSnapshot(); 36 TestThreadSnapshot();
34 ~TestThreadSnapshot(); 37 ~TestThreadSnapshot();
(...skipping 19 matching lines...) Expand all
54 //! TestThreadSnapshot object takes ownership of \a stack. 57 //! TestThreadSnapshot object takes ownership of \a stack.
55 void SetStack(scoped_ptr<MemorySnapshot> stack) { stack_ = stack.Pass(); } 58 void SetStack(scoped_ptr<MemorySnapshot> stack) { stack_ = stack.Pass(); }
56 59
57 void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; } 60 void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; }
58 void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; } 61 void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; }
59 void SetPriority(int priority) { priority_ = priority; } 62 void SetPriority(int priority) { priority_ = priority; }
60 void SetThreadSpecificDataAddress(uint64_t thread_specific_data_address) { 63 void SetThreadSpecificDataAddress(uint64_t thread_specific_data_address) {
61 thread_specific_data_address_ = thread_specific_data_address; 64 thread_specific_data_address_ = thread_specific_data_address;
62 } 65 }
63 66
67 //! \brief Add a memory snapshot to be returned by ExtraMemory().
68 //!
69 //! \param[in] extra_memory The memory snapshot that will be included in
70 //! ExtraMemory(). The TestThreadSnapshot object takes ownership of \a
71 //! extra_memory.
72 void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) {
73 extra_memory_.push_back(extra_memory.release());
74 }
75
64 // ThreadSnapshot: 76 // ThreadSnapshot:
65 77
66 const CPUContext* Context() const override; 78 const CPUContext* Context() const override;
67 const MemorySnapshot* Stack() const override; 79 const MemorySnapshot* Stack() const override;
68 uint64_t ThreadID() const override; 80 uint64_t ThreadID() const override;
69 int SuspendCount() const override; 81 int SuspendCount() const override;
70 int Priority() const override; 82 int Priority() const override;
71 uint64_t ThreadSpecificDataAddress() const override; 83 uint64_t ThreadSpecificDataAddress() const override;
84 std::vector<const MemorySnapshot*> ExtraMemory() const override;
72 85
73 private: 86 private:
74 union { 87 union {
75 CPUContextX86 x86; 88 CPUContextX86 x86;
76 CPUContextX86_64 x86_64; 89 CPUContextX86_64 x86_64;
77 } context_union_; 90 } context_union_;
78 CPUContext context_; 91 CPUContext context_;
79 scoped_ptr<MemorySnapshot> stack_; 92 scoped_ptr<MemorySnapshot> stack_;
80 uint64_t thread_id_; 93 uint64_t thread_id_;
81 int suspend_count_; 94 int suspend_count_;
82 int priority_; 95 int priority_;
83 uint64_t thread_specific_data_address_; 96 uint64_t thread_specific_data_address_;
97 PointerVector<MemorySnapshot> extra_memory_;
84 98
85 DISALLOW_COPY_AND_ASSIGN(TestThreadSnapshot); 99 DISALLOW_COPY_AND_ASSIGN(TestThreadSnapshot);
86 }; 100 };
87 101
88 } // namespace test 102 } // namespace test
89 } // namespace crashpad 103 } // namespace crashpad
90 104
91 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_ 105 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_THREAD_SNAPSHOT_H_
OLDNEW
« no previous file with comments | « snapshot/test/test_process_snapshot.h ('k') | snapshot/test/test_thread_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698