Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually record/replay operating system version on macOS #821

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions base/system/sys_info_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"

#include "base/record_replay.h"

namespace base {

namespace {
Expand Down Expand Up @@ -56,8 +58,17 @@
void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
int32_t* minor_version,
int32_t* bugfix_version) {
NSOperatingSystemVersion version =
[[NSProcessInfo processInfo] operatingSystemVersion];
// It is difficult to record/replay the operatingSystemVersion message below
// because different library calls with different signatures are used on x64 vs. ARM
// (objc_msgSend_stret vs. objc_msgSend). Manually record/replay the resulting
// version to workaround this problem.
NSOperatingSystemVersion version;
if (recordreplay::IsRecording()) {
recordreplay::AutoPassThroughEvents pt;
version = [[NSProcessInfo processInfo] operatingSystemVersion];
}
recordreplay::RecordReplayBytes("SysInfo::OperatingSystemVersionNumbers",
&version, sizeof(version));
*major_version = saturated_cast<int32_t>(version.majorVersion);
*minor_version = saturated_cast<int32_t>(version.minorVersion);
*bugfix_version = saturated_cast<int32_t>(version.patchVersion);
Expand Down
Loading