This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer_common] Refactor SuspendedThreadsList to let it be used with different thread ID types
AbandonedPublic

Authored by glider on Jul 23 2014, 9:00 AM.

Details

Reviewers
earthdok
Summary

This patch makes SuspendedThreadsList a template parameterized by the thread ID type, so that different platforms (e.g. Linux and OSX) can share the implementation. The SuspendedThreadsRegisters interface is extracted to keep existing code that uses SuspendedThreadsList platform-agnostic.

Diff Detail

Event Timeline

glider updated this revision to Diff 11811.Jul 23 2014, 9:00 AM
glider retitled this revision from to [sanitizer_common] Refactor SuspendedThreadsList to let it be used with different thread ID types.
glider updated this object.
glider edited the test plan for this revision. (Show Details)
glider added a reviewer: earthdok.
glider added a subscriber: Unknown Object (MLST).
earthdok edited edge metadata.Jul 24 2014, 5:39 AM

What does this patch do that couldn't be achieved with the following change:

diff --git a/lib/sanitizer_common/sanitizer_stoptheworld.h b/lib/sanitizer_common/sanitizer_stoptheworld.h
index a326467..46619c9 100644

  • a/lib/sanitizer_common/sanitizer_stoptheworld.h

+++ b/lib/sanitizer_common/sanitizer_stoptheworld.h
@@ -18,7 +18,11 @@
#include "sanitizer_common.h"

namespace __sanitizer {
+#if SANITIZER_LINUX
typedef int SuspendedThreadID;
+#elif SANITIZER_MAC
+typedef macos_thread_t SuspendedThreadID;
+#endif

Holds the list of suspended threads and provides an interface to dump their
register contexts.

Closing this issue per the offline discussion. I like your suggestion more.

glider abandoned this revision.Jul 25 2014, 4:17 AM