| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/debug/proc_maps_linux.h" | 8 #include "base/debug/proc_maps_linux.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // if the program was currently executing on a different stack. | 220 // if the program was currently executing on a different stack. |
| 221 // | 221 // |
| 222 // Starting in 3.4, the kernel will print out the vma containing the current | 222 // Starting in 3.4, the kernel will print out the vma containing the current |
| 223 // stack pointer as [stack:TID] as long as that vma does not lie within | 223 // stack pointer as [stack:TID] as long as that vma does not lie within |
| 224 // mm->start_stack. | 224 // mm->start_stack. |
| 225 // | 225 // |
| 226 // Because this has gotten too complicated and brittle of a test, completely | 226 // Because this has gotten too complicated and brittle of a test, completely |
| 227 // ignore checking for the stack and address when running under Valgrind. | 227 // ignore checking for the stack and address when running under Valgrind. |
| 228 // See http://crbug.com/431702 for more details. | 228 // See http://crbug.com/431702 for more details. |
| 229 if (!RunningOnValgrind() && regions[i].path == "[stack]") { | 229 if (!RunningOnValgrind() && regions[i].path == "[stack]") { |
| 230 // On Android the test is run on a background thread, since [stack] is for |
| 231 // the main thread, we cannot test this. |
| 232 #if !defined(OS_ANDROID) |
| 230 EXPECT_GE(address, regions[i].start); | 233 EXPECT_GE(address, regions[i].start); |
| 231 EXPECT_LT(address, regions[i].end); | 234 EXPECT_LT(address, regions[i].end); |
| 235 #endif |
| 232 EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::READ); | 236 EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::READ); |
| 233 EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::WRITE); | 237 EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::WRITE); |
| 234 EXPECT_FALSE(regions[i].permissions & MappedMemoryRegion::EXECUTE); | 238 EXPECT_FALSE(regions[i].permissions & MappedMemoryRegion::EXECUTE); |
| 235 EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::PRIVATE); | 239 EXPECT_TRUE(regions[i].permissions & MappedMemoryRegion::PRIVATE); |
| 236 EXPECT_FALSE(found_stack) << "Found duplicate stacks"; | 240 EXPECT_FALSE(found_stack) << "Found duplicate stacks"; |
| 237 found_stack = true; | 241 found_stack = true; |
| 238 } | 242 } |
| 239 | 243 |
| 240 if (address >= regions[i].start && address < regions[i].end) { | 244 if (address >= regions[i].start && address < regions[i].end) { |
| 241 EXPECT_FALSE(found_address) << "Found same address in multiple regions"; | 245 EXPECT_FALSE(found_address) << "Found same address in multiple regions"; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 EXPECT_EQ(5ULL, regions.size()); | 338 EXPECT_EQ(5ULL, regions.size()); |
| 335 EXPECT_EQ("/bin/cat", regions[0].path); | 339 EXPECT_EQ("/bin/cat", regions[0].path); |
| 336 EXPECT_EQ("/lib/x86_64-linux-gnu/libc-2.15.so", regions[1].path); | 340 EXPECT_EQ("/lib/x86_64-linux-gnu/libc-2.15.so", regions[1].path); |
| 337 EXPECT_EQ("/lib/x86_64-linux-gnu/ld-2.15.so", regions[2].path); | 341 EXPECT_EQ("/lib/x86_64-linux-gnu/ld-2.15.so", regions[2].path); |
| 338 EXPECT_EQ("\"vd so\"", regions[3].path); | 342 EXPECT_EQ("\"vd so\"", regions[3].path); |
| 339 EXPECT_EQ("[vsys call]", regions[4].path); | 343 EXPECT_EQ("[vsys call]", regions[4].path); |
| 340 } | 344 } |
| 341 | 345 |
| 342 } // namespace debug | 346 } // namespace debug |
| 343 } // namespace base | 347 } // namespace base |
| OLD | NEW |