Index: src/d8.js |
=================================================================== |
--- src/d8.js (revision 1518) |
+++ src/d8.js (working copy) |
@@ -324,6 +324,10 @@ |
this.request_ = this.clearCommandToJSONRequest_(args); |
break; |
+ case 'threads': |
+ this.request_ = this.threadsCommandToJSONRequest_(args); |
+ break; |
+ |
case 'trace': |
// Return undefined to indicate command handled internally (no JSON). |
this.request_ = void 0; |
@@ -686,6 +690,14 @@ |
}; |
+// Create a JSON request for the threads command. |
+DebugRequest.prototype.threadsCommandToJSONRequest_ = function(args) { |
+ // Build a threads request from the text command. |
+ var request = this.createRequest('threads'); |
+ return request.toJSONProtocol(); |
+}; |
+ |
+ |
// Handle the trace command. |
DebugRequest.prototype.traceCommand_ = function(args) { |
// Process arguments. |
@@ -919,6 +931,18 @@ |
details.text = result; |
break; |
+ case 'threads': |
+ var result = 'Active V8 threads: ' + body.totalThreads + '\n'; |
+ body.threads.sort(function(a, b) { return a.id - b.id; }); |
+ for (i = 0; i < body.threads.length; i++) { |
+ result += body.threads[i].current ? '*' : ' '; |
+ result += ' '; |
+ result += body.threads[i].id; |
+ result += '\n'; |
+ } |
+ details.text = result; |
+ break; |
+ |
case 'continue': |
details.text = "(running)"; |
break; |