Skip to content

Commit 31cc4cc

Browse files
authored
[compiler-rt][fuzzer] implements SetThreadName for fuchsia. (#99953)
1 parent f5664f5 commit 31cc4cc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,13 @@ size_t PageSize() {
607607
}
608608

609609
void SetThreadName(std::thread &thread, const std::string &name) {
610-
// TODO ?
610+
if (name.size() > 31)
611+
name.resize(31);
612+
zx_status_t s;
613+
if ((s = zx_object_set_property(thread.native_handle(), ZX_PROP_NAME,
614+
name.c_str(), name.size())) != ZX_OK)
615+
Printf("SetThreadName for name %s failed: %s", name.c_str(),
616+
zx_status_get_string(s));
611617
}
612618

613619
} // namespace fuzzer

0 commit comments

Comments
 (0)