mac-arm64: Make MacModelAndBoard use target-type instead of board-id

Bug: crashpad:345
Test: crashpad_util_test MacUtil.MacModelAndBoard
Change-Id: I3eff29c2fc6ae646808cc9dbde8d0dbefd810962
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2386465
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Mark Mentovai 2020-09-03 22:57:10 -04:00 committed by Commit Bot
parent abfc89bb9b
commit ca83774eea

View File

@ -31,6 +31,7 @@
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "build/build_config.h"
#include "util/mac/sysctl.h" #include "util/mac/sysctl.h"
extern "C" { extern "C" {
@ -328,8 +329,17 @@ void MacModelAndBoard(std::string* model, std::string* board_id) {
if (platform_expert) { if (platform_expert) {
model->assign( model->assign(
IORegistryEntryDataPropertyAsString(platform_expert, CFSTR("model"))); IORegistryEntryDataPropertyAsString(platform_expert, CFSTR("model")));
#if defined(ARCH_CPU_X86_FAMILY)
CFStringRef kBoardProperty = CFSTR("board-id");
#elif defined(ARCH_CPU_ARM64)
// TODO(https://crashpad.chromium.org/bug/352): When production arm64
// hardware is available, determine whether board-id works and switch to it
// if feasible, otherwise, determine whether target-type remains a viable
// alternative.
CFStringRef kBoardProperty = CFSTR("target-type");
#endif
board_id->assign(IORegistryEntryDataPropertyAsString(platform_expert, board_id->assign(IORegistryEntryDataPropertyAsString(platform_expert,
CFSTR("board-id"))); kBoardProperty));
} else { } else {
model->clear(); model->clear();
board_id->clear(); board_id->clear();