[compiler-rt] [compiler-rt][fuzzer] implements SetThreadName for fuchsia. (PR #99953)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 14:21:17 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David CARLIER (devnexen)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/99953.diff


1 Files Affected:

- (modified) compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp (+4-1) 


``````````diff
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

``````````

</details>


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


More information about the llvm-commits mailing list