24683da915
Examples of the new line added to non-symbolic stack traces:
os: linux arch: x64 comp: yes sim: no
(Running on linux-x64c)
os: macos arch: arm64 comp: no sim: yes
(Running on mac-simarm64)
This CL also abstracts out the separate hardcoded strings across
the codebase for host and target OS and architecture into
definitions in platform/globals.h to ensure that they stay
in sync across different uses.
TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag
Issue: https://github.com/flutter/flutter/pull/101586
Change-Id: Ifdfea5138dd1003f561da0174e89aebc165bf9b0
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253283
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#include "vm/compiler/ffi/unit_test.h"
|
|
|
|
#include "platform/syslog.h"
|
|
#include "vm/globals.h"
|
|
|
|
namespace dart {
|
|
namespace compiler {
|
|
namespace ffi {
|
|
|
|
#if defined(DART_TARGET_OS_WINDOWS)
|
|
const char* kOs = "win";
|
|
#else
|
|
const char* kOs = kTargetOperatingSystemName;
|
|
#endif
|
|
|
|
void WriteToFile(char* path, const char* contents) {
|
|
FILE* file;
|
|
file = fopen(path, "w");
|
|
if (file != nullptr) {
|
|
fprintf(file, "%s", contents);
|
|
} else {
|
|
Syslog::Print("Error %d \n", errno);
|
|
}
|
|
fclose(file);
|
|
}
|
|
|
|
void ReadFromFile(char* path, char** buffer_pointer) {
|
|
FILE* file = fopen(path, "rb");
|
|
if (file == nullptr) {
|
|
Syslog::Print("Error %d \n", errno);
|
|
return;
|
|
}
|
|
|
|
fseek(file, 0, SEEK_END);
|
|
size_t size = ftell(file);
|
|
rewind(file);
|
|
|
|
char* buffer = reinterpret_cast<char*>(malloc(sizeof(char) * (size + 1)));
|
|
|
|
fread(buffer, 1, size, file);
|
|
buffer[size] = 0;
|
|
|
|
fclose(file);
|
|
*buffer_pointer = buffer;
|
|
}
|
|
|
|
} // namespace ffi
|
|
} // namespace compiler
|
|
} // namespace dart
|