[RS6000] PR97107, libgo fails to build for power10
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_stoptheworld_fuchsia.cpp
blob3a246443ed9953f37c259bf386f6abe0827b7c3b
1 //===-- sanitizer_stoptheworld_fuchsia.cpp -------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===---------------------------------------------------------------------===//
8 //
9 // See sanitizer_stoptheworld.h for details.
11 //===---------------------------------------------------------------------===//
13 #include "sanitizer_platform.h"
15 #if SANITIZER_FUCHSIA
17 #include <zircon/sanitizer.h>
19 #include "sanitizer_stoptheworld.h"
21 namespace __sanitizer {
23 // The Fuchsia implementation stops the world but doesn't offer a real
24 // SuspendedThreadsList argument. This is enough for ASan's use case,
25 // and LSan does not use this API on Fuchsia.
26 void StopTheWorld(StopTheWorldCallback callback, void *argument) {
27 struct Params {
28 StopTheWorldCallback callback;
29 void *argument;
30 } params = {callback, argument};
31 __sanitizer_memory_snapshot(
32 nullptr, nullptr, nullptr, nullptr,
33 [](zx_status_t, void *data) {
34 auto params = reinterpret_cast<Params *>(data);
35 params->callback({}, params->argument);
37 &params);
40 } // namespace __sanitizer
42 #endif // SANITIZER_FUCHSIA