Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index ec1941e6fd86eec42707e4d41011112961fe2109..5e0294383531a9e9259b89ac9c4e696a3043ae22 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -1415,6 +1415,14 @@ class V8_EXPORT StackFrame { |
}; |
+struct RegisterState { |
+ RegisterState() : pc(NULL), sp(NULL), fp(NULL) {} |
+ void* pc; // Instruction pointer. |
+ void* sp; // Stack pointer. |
+ void* fp; // Frame pointer. |
+}; |
+ |
+ |
/** |
* A JSON Parser. |
*/ |
@@ -4548,6 +4556,22 @@ class V8_EXPORT Isolate { |
void GetHeapStatistics(HeapStatistics* heap_statistics); |
/** |
+ * Get a sample from the isolate. |
+ * Fills out the pointer array provided in buffer |
+ * up to depth elements with the stack trace pointers. |
+ * |
+ * \param state RegisterState which contains values of program counter (pc), |
+ * stack pointer (sp), and frame pointer (fp) |
+ * \param buffer The pointer array to be filled. |
+ * \return captured stack depth on success |
+ * -1 on failure. |
+ * \note GetSample should only be called when the JS thread is paused or |
+ * interrupted. If that is not the case, |
+ * GetSample behaviour is undefined. |
+ */ |
+ int GetSample(const RegisterState& state, void** buffer, unsigned int depth); |
+ |
+ /** |
* Adjusts the amount of registered external memory. Used to give V8 an |
* indication of the amount of externally allocated memory that is kept alive |
* by JavaScript objects. V8 uses this to decide when to perform global |