| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file contains intentional memory errors, some of which may lead to | 5 // This file contains intentional memory errors, some of which may lead to |
| 6 // crashes if the test is ran without special memory testing tools. We use these | 6 // crashes if the test is ran without special memory testing tools. We use these |
| 7 // errors to verify the sanity of the tools. | 7 // errors to verify the sanity of the tools. |
| 8 | 8 |
| 9 #include <stddef.h> |
| 10 |
| 9 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
| 10 #include "base/debug/asan_invalid_access.h" | 12 #include "base/debug/asan_invalid_access.h" |
| 11 #include "base/debug/profiler.h" | 13 #include "base/debug/profiler.h" |
| 12 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 13 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 15 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 14 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "build/build_config.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 19 |
| 17 namespace base { | 20 namespace base { |
| 18 | 21 |
| 19 namespace { | 22 namespace { |
| 20 | 23 |
| 21 const base::subtle::Atomic32 kMagicValue = 42; | 24 const base::subtle::Atomic32 kMagicValue = 42; |
| 22 | 25 |
| 23 // Helper for memory accesses that can potentially corrupt memory or cause a | 26 // Helper for memory accesses that can potentially corrupt memory or cause a |
| 24 // crash during a native run. | 27 // crash during a native run. |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 class B { | 351 class B { |
| 349 virtual void f() {} | 352 virtual void f() {} |
| 350 }; | 353 }; |
| 351 | 354 |
| 352 A a; | 355 A a; |
| 353 EXPECT_DEATH((void)(B*)&a, "ILL_ILLOPN"); | 356 EXPECT_DEATH((void)(B*)&a, "ILL_ILLOPN"); |
| 354 } | 357 } |
| 355 #endif | 358 #endif |
| 356 | 359 |
| 357 } // namespace base | 360 } // namespace base |
| OLD | NEW |