Reset prologue_location before calling code_end
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_stoptheworld_fuchsia.cpp
blob91bf19e40dad8136d64a279b0fad69a6b5a4116e
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"
20 #include "sanitizer_stoptheworld_fuchsia.h"
22 namespace __sanitizer {
24 // The Fuchsia implementation stops the world but doesn't offer a real
25 // SuspendedThreadsList argument. This is enough for ASan's use case,
26 // and LSan does not use this API on Fuchsia.
27 void StopTheWorld(StopTheWorldCallback callback, void *argument) {
28 struct Params {
29 StopTheWorldCallback callback;
30 void *argument;
31 } params = {callback, argument};
32 __sanitizer_memory_snapshot(
33 nullptr, nullptr, nullptr, nullptr,
34 [](zx_status_t, void *data) {
35 auto params = reinterpret_cast<Params *>(data);
36 params->callback(SuspendedThreadsListFuchsia(), params->argument);
38 &params);
41 } // namespace __sanitizer
43 #endif // SANITIZER_FUCHSIA