@@ -701,7 +701,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
701
701
// DYLD_FORCE_PLATFORM=6. In that case, force the platform to
702
702
// macCatalyst and use the macCatalyst version of the host OS
703
703
// instead of the macOS deployment target.
704
- if (is_executable && GetProcessPlatformViaDYLDSPI () == PLATFORM_MACCATALYST) {
704
+ if (is_executable && GetPlatform () == PLATFORM_MACCATALYST) {
705
705
info.platform = PLATFORM_MACCATALYST;
706
706
std::string catalyst_version = GetMacCatalystVersionString ();
707
707
const char *major = catalyst_version.c_str ();
@@ -1103,6 +1103,12 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1103
1103
bool privateCache;
1104
1104
};
1105
1105
1106
+ uint32_t MachProcess::GetPlatform () {
1107
+ if (m_platform == 0 )
1108
+ m_platform = MachProcess::GetProcessPlatformViaDYLDSPI ();
1109
+ return m_platform;
1110
+ }
1111
+
1106
1112
uint32_t MachProcess::GetProcessPlatformViaDYLDSPI () {
1107
1113
kern_return_t kern_ret;
1108
1114
uint32_t platform = 0 ;
@@ -1158,7 +1164,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1158
1164
1159
1165
std::vector<struct binary_image_information > image_infos;
1160
1166
GetAllLoadedBinariesViaDYLDSPI (image_infos);
1161
- uint32_t platform = GetProcessPlatformViaDYLDSPI ();
1167
+ uint32_t platform = GetPlatform ();
1162
1168
const size_t image_count = image_infos.size ();
1163
1169
for (size_t i = 0 ; i < image_count; i++) {
1164
1170
GetMachOInformationFromMemory (platform,
@@ -1189,7 +1195,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1189
1195
1190
1196
std::vector<struct binary_image_information > all_image_infos;
1191
1197
GetAllLoadedBinariesViaDYLDSPI (all_image_infos);
1192
- uint32_t platform = GetProcessPlatformViaDYLDSPI ();
1198
+ uint32_t platform = GetPlatform ();
1193
1199
1194
1200
std::vector<struct binary_image_information > image_infos;
1195
1201
const size_t macho_addresses_count = macho_addresses.size ();
@@ -1355,6 +1361,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1355
1361
// Clear any cached thread list while the pid and task are still valid
1356
1362
1357
1363
m_task.Clear ();
1364
+ m_platform = 0 ;
1358
1365
// Now clear out all member variables
1359
1366
m_pid = INVALID_NUB_PROCESS;
1360
1367
if (!detaching)
@@ -1646,6 +1653,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1646
1653
1647
1654
// NULL our task out as we have already restored all exception ports
1648
1655
m_task.Clear ();
1656
+ m_platform = 0 ;
1649
1657
1650
1658
// Clear out any notion of the process we once were
1651
1659
const bool detaching = true ;
0 commit comments