OLD | NEW |
---|---|
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 reinterpret_cast<uintptr_t>(GetModuleHandle(L"ntdll.dll"))); | 94 reinterpret_cast<uintptr_t>(GetModuleHandle(L"ntdll.dll"))); |
95 | 95 |
96 EXPECT_GT(modules[0].size, 0); | 96 EXPECT_GT(modules[0].size, 0); |
97 EXPECT_GT(modules[1].size, 0); | 97 EXPECT_GT(modules[1].size, 0); |
98 | 98 |
99 EXPECT_EQ(modules[0].timestamp, | 99 EXPECT_EQ(modules[0].timestamp, |
100 GetTimestampForModule(GetModuleHandle(nullptr))); | 100 GetTimestampForModule(GetModuleHandle(nullptr))); |
101 // System modules are forced to particular stamps and the file header values | 101 // System modules are forced to particular stamps and the file header values |
102 // don't match the on-disk times. Just make sure we got some data here. | 102 // don't match the on-disk times. Just make sure we got some data here. |
103 EXPECT_GT(modules[1].timestamp, 0); | 103 EXPECT_GT(modules[1].timestamp, 0); |
104 | |
105 // Find something we know is a code address and confirm expected memory | |
106 // information settings. | |
107 const std::vector<ProcessInfo::MemoryInfo>& memory_info = | |
108 process_info.MemoryInformation(); | |
109 WinVMAddress code_address = reinterpret_cast<WinVMAddress>(_ReturnAddress()); | |
110 bool found_region = false; | |
111 for (const auto& mi : memory_info) { | |
112 if (mi.base_address <= code_address && | |
113 mi.base_address + mi.region_size > code_address) { | |
114 EXPECT_EQ(MEM_COMMIT, mi.state); | |
115 EXPECT_EQ(PAGE_EXECUTE_READ, mi.protect); | |
116 EXPECT_EQ(MEM_IMAGE, mi.type); | |
117 found_region = true; | |
118 break; | |
Mark Mentovai
2015/09/26 02:02:14
Don’t break. Walk the whole list, and before you s
scottmg
2015/09/26 03:12:36
Done.
| |
119 } | |
120 } | |
121 EXPECT_TRUE(found_region); | |
104 } | 122 } |
105 | 123 |
106 void TestOtherProcess(const base::string16& directory_modification) { | 124 void TestOtherProcess(const base::string16& directory_modification) { |
107 ProcessInfo process_info; | 125 ProcessInfo process_info; |
108 | 126 |
109 UUID started_uuid(UUID::InitializeWithNewTag{}); | 127 UUID started_uuid(UUID::InitializeWithNewTag{}); |
110 UUID done_uuid(UUID::InitializeWithNewTag{}); | 128 UUID done_uuid(UUID::InitializeWithNewTag{}); |
111 | 129 |
112 ScopedKernelHANDLE started( | 130 ScopedKernelHANDLE started( |
113 CreateEvent(nullptr, true, false, started_uuid.ToString16().c_str())); | 131 CreateEvent(nullptr, true, false, started_uuid.ToString16().c_str())); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 TestOtherProcess(FILE_PATH_LITERAL("..\\..\\out\\Debug")); | 189 TestOtherProcess(FILE_PATH_LITERAL("..\\..\\out\\Debug")); |
172 #else | 190 #else |
173 TestOtherProcess(FILE_PATH_LITERAL("..\\..\\out\\Release")); | 191 TestOtherProcess(FILE_PATH_LITERAL("..\\..\\out\\Release")); |
174 #endif | 192 #endif |
175 } | 193 } |
176 #endif // ARCH_CPU_64_BITS | 194 #endif // ARCH_CPU_64_BITS |
177 | 195 |
178 } // namespace | 196 } // namespace |
179 } // namespace test | 197 } // namespace test |
180 } // namespace crashpad | 198 } // namespace crashpad |
OLD | NEW |