Index: src/debug.h |
diff --git a/src/debug.h b/src/debug.h |
index 9a9a3ba9239d035b69ed1e6e9c05442cfa0c2259..5fe56d3e212ba3cc43ceba249979d83988c8ce31 100644 |
--- a/src/debug.h |
+++ b/src/debug.h |
@@ -732,6 +732,27 @@ class Debug { |
Object** restarter_frame_function_pointer_; |
}; |
+ |
+ class PreserveDebugState { |
+ public: |
+ explicit PreserveDebugState(Debug* debug) : debug_(debug) { |
+ size_t size = sizeof(debug_->thread_local_); |
+ storage_ = NewArray<char>(size); |
+ MemCopy(storage_, &debug_->thread_local_, size); |
+ } |
+ |
+ ~PreserveDebugState() { |
+ size_t size = sizeof(debug_->thread_local_); |
+ MemCopy(&debug_->thread_local_, storage_, size); |
+ DeleteArray(storage_); |
+ } |
+ |
+ private: |
+ Debug* debug_; |
+ char* storage_; |
+ }; |
+ |
+ |
// Storage location for registers when handling debug break calls |
ThreadLocal thread_local_; |