@@ -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 ();
@@ -1094,6 +1094,12 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1094
1094
bool privateCache;
1095
1095
};
1096
1096
1097
+ uint32_t MachProcess::GetPlatform () {
1098
+ if (m_platform == 0 )
1099
+ m_platform = MachProcess::GetProcessPlatformViaDYLDSPI ();
1100
+ return m_platform;
1101
+ }
1102
+
1097
1103
uint32_t MachProcess::GetProcessPlatformViaDYLDSPI () {
1098
1104
kern_return_t kern_ret;
1099
1105
uint32_t platform = 0 ;
@@ -1140,7 +1146,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1140
1146
int pointer_size = GetInferiorAddrSize (pid);
1141
1147
std::vector<struct binary_image_information > image_infos;
1142
1148
GetAllLoadedBinariesViaDYLDSPI (image_infos);
1143
- uint32_t platform = GetProcessPlatformViaDYLDSPI ();
1149
+ uint32_t platform = GetPlatform ();
1144
1150
const size_t image_count = image_infos.size ();
1145
1151
for (size_t i = 0 ; i < image_count; i++) {
1146
1152
GetMachOInformationFromMemory (platform, image_infos[i].load_address ,
@@ -1160,7 +1166,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1160
1166
1161
1167
std::vector<struct binary_image_information > all_image_infos;
1162
1168
GetAllLoadedBinariesViaDYLDSPI (all_image_infos);
1163
- uint32_t platform = GetProcessPlatformViaDYLDSPI ();
1169
+ uint32_t platform = GetPlatform ();
1164
1170
1165
1171
std::vector<struct binary_image_information > image_infos;
1166
1172
const size_t macho_addresses_count = macho_addresses.size ();
@@ -1324,6 +1330,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1324
1330
// Clear any cached thread list while the pid and task are still valid
1325
1331
1326
1332
m_task.Clear ();
1333
+ m_platform = 0 ;
1327
1334
// Now clear out all member variables
1328
1335
m_pid = INVALID_NUB_PROCESS;
1329
1336
if (!detaching)
@@ -1615,6 +1622,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options,
1615
1622
1616
1623
// NULL our task out as we have already restored all exception ports
1617
1624
m_task.Clear ();
1625
+ m_platform = 0 ;
1618
1626
1619
1627
// Clear out any notion of the process we once were
1620
1628
const bool detaching = true ;
0 commit comments