Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/d8.js

Issue 48009: Add thread information to the debugger (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/debug-delay.js » ('j') | src/runtime.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 case 'break': 318 case 'break':
319 case 'b': 319 case 'b':
320 this.request_ = this.breakCommandToJSONRequest_(args); 320 this.request_ = this.breakCommandToJSONRequest_(args);
321 break; 321 break;
322 322
323 case 'clear': 323 case 'clear':
324 this.request_ = this.clearCommandToJSONRequest_(args); 324 this.request_ = this.clearCommandToJSONRequest_(args);
325 break; 325 break;
326 326
327 case 'threads':
328 this.request_ = this.threadsCommandToJSONRequest_(args);
329 break;
330
327 case 'trace': 331 case 'trace':
328 // Return undefined to indicate command handled internally (no JSON). 332 // Return undefined to indicate command handled internally (no JSON).
329 this.request_ = void 0; 333 this.request_ = void 0;
330 this.traceCommand_(args); 334 this.traceCommand_(args);
331 break; 335 break;
332 336
333 case 'help': 337 case 'help':
334 case '?': 338 case '?':
335 this.helpCommand_(args); 339 this.helpCommand_(args);
336 // Return undefined to indicate command handled internally (no JSON). 340 // Return undefined to indicate command handled internally (no JSON).
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 request.arguments = {}; 683 request.arguments = {};
680 request.arguments.breakpoint = parseInt(args); 684 request.arguments.breakpoint = parseInt(args);
681 } else { 685 } else {
682 throw new Error('Invalid break arguments.'); 686 throw new Error('Invalid break arguments.');
683 } 687 }
684 688
685 return request.toJSONProtocol(); 689 return request.toJSONProtocol();
686 }; 690 };
687 691
688 692
693 // Create a JSON request for the threads command.
694 DebugRequest.prototype.threadsCommandToJSONRequest_ = function(args) {
695 // Build a threads request from the text command.
696 var request = this.createRequest('threads');
697 return request.toJSONProtocol();
698 };
699
700
689 // Handle the trace command. 701 // Handle the trace command.
690 DebugRequest.prototype.traceCommand_ = function(args) { 702 DebugRequest.prototype.traceCommand_ = function(args) {
691 // Process arguments. 703 // Process arguments.
692 if (args && args.length > 0) { 704 if (args && args.length > 0) {
693 if (args == 'compile') { 705 if (args == 'compile') {
694 trace_compile = !trace_compile; 706 trace_compile = !trace_compile;
695 print('Tracing of compiled scripts ' + (trace_compile ? 'on' : 'off')); 707 print('Tracing of compiled scripts ' + (trace_compile ? 'on' : 'off'));
696 } else { 708 } else {
697 throw new Error('Invalid trace arguments.'); 709 throw new Error('Invalid trace arguments.');
698 } 710 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 var sourceStart = body[i].sourceStart; 924 var sourceStart = body[i].sourceStart;
913 if (sourceStart.length > 40) { 925 if (sourceStart.length > 40) {
914 sourceStart = sourceStart.substring(0, 37) + '...'; 926 sourceStart = sourceStart.substring(0, 37) + '...';
915 } 927 }
916 result += sourceStart; 928 result += sourceStart;
917 result += ']'; 929 result += ']';
918 } 930 }
919 details.text = result; 931 details.text = result;
920 break; 932 break;
921 933
934 case 'threads':
935 var result = 'Active V8 threads: ' + body.totalThreads + '\n';
936 body.threads.sort(function(a, b) { return a.id - b.id; });
937 for (i = 0; i < body.threads.length; i++) {
938 result += body.threads[i].current ? '*' : ' ';
939 result += ' ';
940 result += body.threads[i].id;
941 result += '\n';
942 }
943 details.text = result;
944 break;
945
922 case 'continue': 946 case 'continue':
923 details.text = "(running)"; 947 details.text = "(running)";
924 break; 948 break;
925 949
926 default: 950 default:
927 details.text = 951 details.text =
928 'Response for unknown command \'' + response.command + '\'' + 952 'Response for unknown command \'' + response.command + '\'' +
929 ' (' + json_response + ')'; 953 ' (' + json_response + ')';
930 } 954 }
931 } catch (e) { 955 } catch (e) {
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 json += NumberToJSON_(elem); 1425 json += NumberToJSON_(elem);
1402 } else if (typeof(elem) === 'string') { 1426 } else if (typeof(elem) === 'string') {
1403 json += StringToJSON_(elem); 1427 json += StringToJSON_(elem);
1404 } else { 1428 } else {
1405 json += elem; 1429 json += elem;
1406 } 1430 }
1407 } 1431 }
1408 json += ']'; 1432 json += ']';
1409 return json; 1433 return json;
1410 } 1434 }
OLDNEW
« no previous file with comments | « no previous file | src/debug-delay.js » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698