[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 14:20:44 PDT 2024


https://github.com/devnexen created https://github.com/llvm/llvm-project/pull/99953

None

>From 715c392fd069dd3ca3507689439533fabd7e5865 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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
index fe79e1908d602..0e0dd5a232596 100644
--- a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
@@ -607,7 +607,10 @@ size_t PageSize() {
 }
 
 void SetThreadName(std::thread &thread, const std::string &name) {
-  // TODO ?
+  if (name.size() > 31) {
+    name.resize(31); 
+  } 
+  (void)zx_object_set_property(thread.native_handle(), ZX_PROP_NAME, name.c_str(), name.size());
 }
 
 } // namespace fuzzer



More information about the llvm-commits mailing list