Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |