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

Side by Side Diff: src/debug-delay.js

Issue 13785: Give an error when setting break points in functions either defined through t... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (break_point) { 467 if (break_point) {
468 return break_point; 468 return break_point;
469 } else { 469 } else {
470 return this.findScriptBreakPoint(break_point_number, remove); 470 return this.findScriptBreakPoint(break_point_number, remove);
471 } 471 }
472 }; 472 };
473 473
474 474
475 Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) { 475 Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) {
476 if (!IS_FUNCTION(func)) throw new Error('Parameters have wrong types.'); 476 if (!IS_FUNCTION(func)) throw new Error('Parameters have wrong types.');
477 // Break points in API functions are not supported.
478 if (%FunctionIsAPIFunction(func)) {
479 throw new Error('Cannot set break point in native code.');
Christian Plesner Hansen 2008/12/15 09:01:46 Given that all our code is native this error messa
Søren Thygesen Gjesse 2008/12/15 09:29:50 I decided on the error message based on the "toStr
Christian Plesner Hansen 2008/12/15 09:35:29 Good point, let's stay consistent. (I remember fi
480 }
477 var source_position = this.findFunctionSourcePosition(func, opt_line, opt_colu mn) - 481 var source_position = this.findFunctionSourcePosition(func, opt_line, opt_colu mn) -
478 this.sourcePosition(func); 482 this.sourcePosition(func);
479 // Find the script for the function. 483 // Find the script for the function.
480 var script = %FunctionGetScript(func); 484 var script = %FunctionGetScript(func);
485 // Break in builtin JavaScript code is not supported.
486 if (script.type == Debug.ScriptType.Native) {
487 throw new Error('Cannot set break point in native code.');
488 }
481 // If the script for the function has a name convert this to a script break 489 // If the script for the function has a name convert this to a script break
482 // point. 490 // point.
483 if (script && script.name) { 491 if (script && script.name) {
484 // Adjust the source position to be script relative. 492 // Adjust the source position to be script relative.
485 source_position += %FunctionGetScriptSourcePosition(func); 493 source_position += %FunctionGetScriptSourcePosition(func);
486 // Find line and column for the position in the script and set a script 494 // Find line and column for the position in the script and set a script
487 // break point from that. 495 // break point from that.
488 var location = script.locationFromPosition(source_position); 496 var location = script.locationFromPosition(source_position);
489 return this.setScriptBreakPoint(script.name, 497 return this.setScriptBreakPoint(script.name,
490 location.line, location.column, 498 location.line, location.column,
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 json += NumberToJSON_(elem); 1662 json += NumberToJSON_(elem);
1655 } else if (IS_STRING(elem)) { 1663 } else if (IS_STRING(elem)) {
1656 json += StringToJSON_(elem); 1664 json += StringToJSON_(elem);
1657 } else { 1665 } else {
1658 json += elem; 1666 json += elem;
1659 } 1667 }
1660 } 1668 }
1661 json += ']'; 1669 json += ']';
1662 return json; 1670 return json;
1663 } 1671 }
OLDNEW
« no previous file with comments | « no previous file | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698