summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_stoptheworld.h
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2013-04-01 13:36:42 +0000
committerAlexander Potapenko <glider@google.com>2013-04-01 13:36:42 +0000
commit53c18d7e051c7dfe3cc8a2351e6ee67a264dbb51 (patch)
tree82940b0b5b3ffe04c8efb484e55ea7628662aa64 /lib/sanitizer_common/sanitizer_stoptheworld.h
parent939316c822cc46e62684464eecd5cb2cefcf41c5 (diff)
downloadcompiler-rt-53c18d7e051c7dfe3cc8a2351e6ee67a264dbb51.tar.gz
[libsanitizer] Add register dumping support to SuspendedThreadsList.
An interface for obtaining register contexts from suspended threads. Tailored for LSan use. Patch by Sergey Matveev (earthdok@google.com) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@178461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_stoptheworld.h')
-rw-r--r--lib/sanitizer_common/sanitizer_stoptheworld.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sanitizer_common/sanitizer_stoptheworld.h b/lib/sanitizer_common/sanitizer_stoptheworld.h
index 5dd349894..cc9408bb8 100644
--- a/lib/sanitizer_common/sanitizer_stoptheworld.h
+++ b/lib/sanitizer_common/sanitizer_stoptheworld.h
@@ -20,21 +20,21 @@
namespace __sanitizer {
typedef int SuspendedThreadID;
-// Holds the list of suspended threads. Also provides register dumping
-// functionality (to be implemented).
+// Holds the list of suspended threads and provides an interface to dump their
+// register contexts.
class SuspendedThreadsList {
public:
SuspendedThreadsList()
: thread_ids_(1024) {}
- SuspendedThreadID GetThreadID(uptr index) {
+ SuspendedThreadID GetThreadID(uptr index) const {
CHECK_LT(index, thread_ids_.size());
return thread_ids_[index];
}
- void DumpRegisters(uptr index) const {
- UNIMPLEMENTED();
- }
- uptr thread_count() { return thread_ids_.size(); }
- bool Contains(SuspendedThreadID thread_id) {
+ int GetRegistersAndSP(uptr index, uptr *buffer, uptr *sp) const;
+ // The buffer in GetRegistersAndSP should be at least this big.
+ static uptr RegisterCount();
+ uptr thread_count() const { return thread_ids_.size(); }
+ bool Contains(SuspendedThreadID thread_id) const {
for (uptr i = 0; i < thread_ids_.size(); i++) {
if (thread_ids_[i] == thread_id)
return true;