| OLD | NEW |
| 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_EXCEPTION_SNAPSHOT_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_EXCEPTION_SNAPSHOT_H_ |
| 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_EXCEPTION_SNAPSHOT_H_ | 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_EXCEPTION_SNAPSHOT_H_ |
| 17 | 17 |
| 18 #include <stdint.h> | 18 #include <stdint.h> |
| 19 | 19 |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "base/macros.h" | 22 #include "base/macros.h" |
| 23 #include "base/memory/scoped_ptr.h" |
| 23 #include "snapshot/cpu_context.h" | 24 #include "snapshot/cpu_context.h" |
| 24 #include "snapshot/exception_snapshot.h" | 25 #include "snapshot/exception_snapshot.h" |
| 26 #include "util/stdlib/pointer_container.h" |
| 25 | 27 |
| 26 namespace crashpad { | 28 namespace crashpad { |
| 27 namespace test { | 29 namespace test { |
| 28 | 30 |
| 29 //! \brief A test ExceptionSnapshot that can carry arbitrary data for testing | 31 //! \brief A test ExceptionSnapshot that can carry arbitrary data for testing |
| 30 //! purposes. | 32 //! purposes. |
| 31 class TestExceptionSnapshot final : public ExceptionSnapshot { | 33 class TestExceptionSnapshot final : public ExceptionSnapshot { |
| 32 public: | 34 public: |
| 33 TestExceptionSnapshot(); | 35 TestExceptionSnapshot(); |
| 34 ~TestExceptionSnapshot(); | 36 ~TestExceptionSnapshot(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 | 52 |
| 51 void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; } | 53 void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; } |
| 52 void SetException(uint32_t exception) { exception_ = exception; } | 54 void SetException(uint32_t exception) { exception_ = exception; } |
| 53 void SetExceptionInfo(uint32_t exception_information) { | 55 void SetExceptionInfo(uint32_t exception_information) { |
| 54 exception_info_ = exception_information; | 56 exception_info_ = exception_information; |
| 55 } | 57 } |
| 56 void SetExceptionAddress(uint64_t exception_address) { | 58 void SetExceptionAddress(uint64_t exception_address) { |
| 57 exception_address_ = exception_address; | 59 exception_address_ = exception_address; |
| 58 } | 60 } |
| 59 void SetCodes(const std::vector<uint64_t>& codes) { codes_ = codes; } | 61 void SetCodes(const std::vector<uint64_t>& codes) { codes_ = codes; } |
| 62 void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) { |
| 63 extra_memory_.push_back(extra_memory.release()); |
| 64 } |
| 60 | 65 |
| 61 // ExceptionSnapshot: | 66 // ExceptionSnapshot: |
| 62 | 67 |
| 63 const CPUContext* Context() const override; | 68 const CPUContext* Context() const override; |
| 64 uint64_t ThreadID() const override; | 69 uint64_t ThreadID() const override; |
| 65 uint32_t Exception() const override; | 70 uint32_t Exception() const override; |
| 66 uint32_t ExceptionInfo() const override; | 71 uint32_t ExceptionInfo() const override; |
| 67 uint64_t ExceptionAddress() const override; | 72 uint64_t ExceptionAddress() const override; |
| 68 const std::vector<uint64_t>& Codes() const override; | 73 const std::vector<uint64_t>& Codes() const override; |
| 74 std::vector<const MemorySnapshot*> ExtraMemory() const override; |
| 69 | 75 |
| 70 private: | 76 private: |
| 71 union { | 77 union { |
| 72 CPUContextX86 x86; | 78 CPUContextX86 x86; |
| 73 CPUContextX86_64 x86_64; | 79 CPUContextX86_64 x86_64; |
| 74 } context_union_; | 80 } context_union_; |
| 75 CPUContext context_; | 81 CPUContext context_; |
| 76 uint64_t thread_id_; | 82 uint64_t thread_id_; |
| 77 uint32_t exception_; | 83 uint32_t exception_; |
| 78 uint32_t exception_info_; | 84 uint32_t exception_info_; |
| 79 uint64_t exception_address_; | 85 uint64_t exception_address_; |
| 80 std::vector<uint64_t> codes_; | 86 std::vector<uint64_t> codes_; |
| 87 PointerVector<MemorySnapshot> extra_memory_; |
| 81 | 88 |
| 82 DISALLOW_COPY_AND_ASSIGN(TestExceptionSnapshot); | 89 DISALLOW_COPY_AND_ASSIGN(TestExceptionSnapshot); |
| 83 }; | 90 }; |
| 84 | 91 |
| 85 } // namespace test | 92 } // namespace test |
| 86 } // namespace crashpad | 93 } // namespace crashpad |
| 87 | 94 |
| 88 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_EXCEPTION_SNAPSHOT_H_ | 95 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_EXCEPTION_SNAPSHOT_H_ |
| OLD | NEW |