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

Unified Diff: third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc

Issue 2236493004: Update Crashpad to 56b14bceefcec03fc11b3222c435522922f65640 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc
diff --git a/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc b/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc
index d54ea3c4b041db0b6e666400eec749e3d370086b..1bb8d101f6df71acbdb248cdb3290f8432eb5e39 100644
--- a/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc
+++ b/third_party/crashpad/crashpad/snapshot/mac/process_types_test.cc
@@ -47,7 +47,9 @@ TEST(ProcessTypes, DyldImagesSelf) {
const struct dyld_all_image_infos* self_image_infos =
_dyld_get_all_image_infos();
int mac_os_x_minor_version = MacOSXMinorVersion();
- if (mac_os_x_minor_version >= 9) {
+ if (mac_os_x_minor_version >= 12) {
+ EXPECT_GE(self_image_infos->version, 15u);
+ } else if (mac_os_x_minor_version >= 9) {
EXPECT_GE(self_image_infos->version, 13u);
} else if (mac_os_x_minor_version >= 7) {
EXPECT_GE(self_image_infos->version, 8u);
@@ -96,6 +98,24 @@ TEST(ProcessTypes, DyldImagesSelf) {
ProcessReader process_reader;
ASSERT_TRUE(process_reader.Initialize(mach_task_self()));
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
+ const uint32_t kDyldAllImageInfosVersionInSDK = 15;
+#elif MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
+ const uint32_t kDyldAllImageInfosVersionInSDK = 14;
+#elif MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ const uint32_t kDyldAllImageInfosVersionInSDK = 12;
+#elif MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+ const uint32_t kDyldAllImageInfosVersionInSDK = 7;
+#else
+ const uint32_t kDyldAllImageInfosVersionInSDK = 1;
+#endif
+
+ // Make sure that the size of the structure as declared in the SDK matches the
+ // size expected for the version of the structure that the SDK describes.
+ EXPECT_EQ(sizeof(dyld_all_image_infos),
+ process_types::dyld_all_image_infos::ExpectedSizeForVersion(
+ &process_reader, kDyldAllImageInfosVersionInSDK));
+
process_types::dyld_all_image_infos proctype_image_infos;
ASSERT_TRUE(proctype_image_infos.Read(&process_reader,
dyld_info.all_image_info_addr));
@@ -194,13 +214,49 @@ TEST(ProcessTypes, DyldImagesSelf) {
proctype_image_infos.sharedCacheUUID,
sizeof(self_image_infos->sharedCacheUUID)));
}
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
+ if (proctype_image_infos.version >= 15) {
+ EXPECT_EQ(self_image_infos->infoArrayChangeTimestamp,
+ proctype_image_infos.infoArrayChangeTimestamp);
+ EXPECT_EQ(self_image_infos->sharedCacheBaseAddress,
+ proctype_image_infos.sharedCacheBaseAddress);
+ EXPECT_EQ(reinterpret_cast<uint64_t>(self_image_infos->dyldPath),
+ proctype_image_infos.dyldPath);
+ for (size_t index = 0;
+ index < arraysize(self_image_infos->notifyPorts);
+ ++index) {
+ EXPECT_EQ(self_image_infos->notifyPorts[index],
+ proctype_image_infos.notifyPorts[index]) << "index " << index;
+ }
+
+ TEST_STRING(
+ process_reader, self_image_infos, proctype_image_infos, dyldPath);
+ }
+#endif
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
+ // As dyld_all_image_infos has evolved over time, new fields were added to the
+ // reserved region. process_types::dyld_all_image_infos declares a recent
+ // version of the structure, but an older SDK may declare an older version
+ // whose |reserved| member appears at a different (smaller) offset than the
+ // process_types version. It’s difficult to compare the reserved fields in
+ // these older SDKs, so only do it where the declarations match.
if (proctype_image_infos.version >= 14) {
- for (size_t index = 0; index < arraysize(self_image_infos->reserved);
+ for (size_t index = 0;
+ index < arraysize(proctype_image_infos.reserved);
++index) {
EXPECT_EQ(implicit_cast<uint64_t>(self_image_infos->reserved[index]),
proctype_image_infos.reserved[index])
<< "index " << index;
}
+#if defined(ARCH_CPU_64_BITS)
+ EXPECT_EQ(self_image_infos->reserved[4], proctype_image_infos.reserved_4);
+ EXPECT_EQ(self_image_infos->reserved[5], proctype_image_infos.reserved_5);
+ EXPECT_EQ(self_image_infos->reserved[6], proctype_image_infos.reserved_6);
+ EXPECT_EQ(self_image_infos->reserved[7], proctype_image_infos.reserved_7);
+ EXPECT_EQ(self_image_infos->reserved[8], proctype_image_infos.reserved_8);
+#endif
}
#endif
@@ -213,7 +269,8 @@ TEST(ProcessTypes, DyldImagesSelf) {
proctype_image_info_vector.size(),
&proctype_image_info_vector[0]));
- for (size_t index = 0; index < proctype_image_infos.infoArrayCount;
+ for (size_t index = 0;
+ index < proctype_image_infos.infoArrayCount;
++index) {
const dyld_image_info* self_image_info =
&self_image_infos->infoArray[index];
@@ -245,7 +302,8 @@ TEST(ProcessTypes, DyldImagesSelf) {
proctype_uuid_info_vector.size(),
&proctype_uuid_info_vector[0]));
- for (size_t index = 0; index < proctype_image_infos.uuidArrayCount;
+ for (size_t index = 0;
+ index < proctype_image_infos.uuidArrayCount;
++index) {
const dyld_uuid_info* self_uuid_info =
&self_image_infos->uuidArray[index];

Powered by Google App Engine
This is Rietveld 408576698