dart-sdk/tests/ffi_2/regress_47594_test.dart
Ryan Macnak b0170463af [infra] Run JIT FFI tests on QEMU.
Change-Id: I97dd32cff783265de6a431276434e79bb030939b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299780
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-26 23:22:32 +00:00

22 lines
802 B
Dart

// Copyright (c) 2021, 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.
//
// Regression test for http://dartbug.com/47594.
// FFI leaf calls did not mark the thread for the transition and would cause
// the stack walker to segfault when it was unable to interpret the frame.
//
// VMOptions=--deterministic --enable-vm-service=0 --profiler --disable-dart-dev
import 'dart:ffi';
import 'package:ffi/ffi.dart';
final strerror = DynamicLibrary.process()
.lookupFunction<Pointer<Utf8> Function(Int32), Pointer<Utf8> Function(int)>(
'strerror',
isLeaf: true);
void main() {
for (var i = 0; i < 10000; i++) strerror(0).toDartString();
}