[compiler-rt] [compiler-rt][fuzzer] implements SetThreadName for fuchsia. (PR #99953)
David CARLIER via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 23:46:34 PDT 2024
https://github.com/devnexen updated https://github.com/llvm/llvm-project/pull/99953
>From 0f50c0ef24ebb8efe93ce291ed1dbb2856eda972 Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen at gmail.com>
Date: Mon, 22 Jul 2024 22:19:43 +0100
Subject: [PATCH] [compiler-rt][fuzzer] implements SetThreadName for fuchsia.
---
compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
index fe79e1908d602..31b99cbb797e1 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
@@ -607,7 +607,12 @@ size_t PageSize() {
}
void SetThreadName(std::thread &thread, const std::string &name) {
- // TODO ?
+ if (name.size() > 31)
+ name.resize(31);
+ zx_status_t s;
+ if ((s = zx_object_set_property(thread.native_handle(), ZX_PROP_NAME,
+ name.c_str(), name.size())) != ZX_OK)
+ Printf("SetThreadName for name %s failed: %d", name.c_str(), s);
}
} // namespace fuzzer
More information about the llvm-commits
mailing list