Adapt dyld_images.proctype to running changes in 10.12

The layout of dyld_all_image_infos changed slightly in 10.12db3 16A254g
and Xcode 8b3 8S174q.

BUG=crashpad:120
TEST=crashpad_snapshot_test ProcessTypes.DyldImagesSelf

Change-Id: I66fb60c80b26f465913f5100a8c40564723b0021
Reviewed-on: https://chromium-review.googlesource.com/361800
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Mark Mentovai 2016-07-19 15:10:26 -04:00
parent 335ef49467
commit 7b8de8a404
3 changed files with 19 additions and 13 deletions

View File

@ -59,11 +59,11 @@ inline void Assign<process_types::internal::Reserved64_64Only64,
*destination = 0;
}
using UInt32Array10 = uint32_t[10];
using UInt64Array10 = uint64_t[10];
using UInt32Array4 = uint32_t[4];
using UInt64Array4 = uint64_t[4];
template <>
inline void Assign<UInt64Array10, UInt32Array10>(UInt64Array10* destination,
const UInt32Array10& source) {
inline void Assign<UInt64Array4, UInt32Array4>(UInt64Array4* destination,
const UInt32Array4& source) {
for (size_t index = 0; index < arraysize(source); ++index) {
(*destination)[index] = source[index];
}

View File

@ -106,20 +106,23 @@ PROCESS_TYPE_STRUCT_BEGIN(dyld_all_image_infos)
// Version 15 (macOS 10.12)
// This space is also allocated in version 14 (OS X 10.9) as part of the
// “reserved” member.
PROCESS_TYPE_STRUCT_MEMBER(uint64_t, infoArrayChangeTimestamp)
PROCESS_TYPE_STRUCT_MEMBER(UIntPtr, sharedCacheBaseAddress)
PROCESS_TYPE_STRUCT_MEMBER(uint64_t, infoArrayChangeTimestamp)
PROCESS_TYPE_STRUCT_MEMBER(Pointer, dyldPath) // const char*
// These should be considered mach_port_name_t when interacting with them from
// another Mach IPC namespace (process).
PROCESS_TYPE_STRUCT_MEMBER(mach_port_t, notifyPorts, [2])
PROCESS_TYPE_STRUCT_MEMBER(mach_port_t, notifyPorts, [8])
// Version 14 (OS X 10.9)
// As of the 10.12 SDK, this is declared as reserved[10] for 64-bit platforms
// and reserved[12] for 32-bit platforms.
PROCESS_TYPE_STRUCT_MEMBER(UIntPtr, reserved, [10])
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_10)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_11)
// As of the 10.12 SDK, this is declared as reserved[9] for 64-bit platforms
// and reserved[4] for 32-bit platforms.
PROCESS_TYPE_STRUCT_MEMBER(UIntPtr, reserved, [4])
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_4)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_5)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_6)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_7)
PROCESS_TYPE_STRUCT_MEMBER(Reserved64_64Only, reserved_8)
PROCESS_TYPE_STRUCT_END(dyld_all_image_infos)
#endif // ! PROCESS_TYPE_STRUCT_IMPLEMENT_INTERNAL_READ_INTO &&

View File

@ -251,8 +251,11 @@ TEST(ProcessTypes, DyldImagesSelf) {
<< "index " << index;
}
#if defined(ARCH_CPU_64_BITS)
EXPECT_EQ(self_image_infos->reserved[10], proctype_image_infos.reserved_10);
EXPECT_EQ(self_image_infos->reserved[11], proctype_image_infos.reserved_11);
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