sanitizer_stoptheworld_fuchsia.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.
  10. //
  11. //===---------------------------------------------------------------------===//
  12. #include "sanitizer_platform.h"
  13. #if SANITIZER_FUCHSIA
  14. #error #include <zircon/sanitizer.h>
  15. #include "sanitizer_stoptheworld.h"
  16. #include "sanitizer_stoptheworld_fuchsia.h"
  17. namespace __sanitizer {
  18. // The Fuchsia implementation stops the world but doesn't offer a real
  19. // SuspendedThreadsList argument. This is enough for ASan's use case,
  20. // and LSan does not use this API on Fuchsia.
  21. void StopTheWorld(StopTheWorldCallback callback, void *argument) {
  22. struct Params {
  23. StopTheWorldCallback callback;
  24. void *argument;
  25. } params = {callback, argument};
  26. __sanitizer_memory_snapshot(
  27. nullptr, nullptr, nullptr, nullptr,
  28. [](zx_status_t, void *data) {
  29. auto params = reinterpret_cast<Params *>(data);
  30. params->callback(SuspendedThreadsListFuchsia(), params->argument);
  31. },
  32. &params);
  33. }
  34. } // namespace __sanitizer
  35. #endif // SANITIZER_FUCHSIA