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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 var type = request.arguments.type; | 1266 var type = request.arguments.type; |
1267 var target = request.arguments.target; | 1267 var target = request.arguments.target; |
1268 var line = request.arguments.line; | 1268 var line = request.arguments.line; |
1269 var column = request.arguments.column; | 1269 var column = request.arguments.column; |
1270 var enabled = IS_UNDEFINED(request.arguments.enabled) ? | 1270 var enabled = IS_UNDEFINED(request.arguments.enabled) ? |
1271 true : request.arguments.enabled; | 1271 true : request.arguments.enabled; |
1272 var condition = request.arguments.condition; | 1272 var condition = request.arguments.condition; |
1273 var ignoreCount = request.arguments.ignoreCount; | 1273 var ignoreCount = request.arguments.ignoreCount; |
1274 | 1274 |
1275 // Check for legal arguments. | 1275 // Check for legal arguments. |
1276 if (!type || !target) { | 1276 if (!type || IS_UNDEFINED(target)) { |
1277 response.failed('Missing argument "type" or "target"'); | 1277 response.failed('Missing argument "type" or "target"'); |
1278 return; | 1278 return; |
1279 } | 1279 } |
1280 if (type != 'function' && type != 'script' && type != 'scriptId') { | 1280 if (type != 'function' && type != 'handle' && |
| 1281 type != 'script' && type != 'scriptId') { |
1281 response.failed('Illegal type "' + type + '"'); | 1282 response.failed('Illegal type "' + type + '"'); |
1282 return; | 1283 return; |
1283 } | 1284 } |
1284 | 1285 |
1285 // Either function or script break point. | 1286 // Either function or script break point. |
1286 var break_point_number; | 1287 var break_point_number; |
1287 if (type == 'function') { | 1288 if (type == 'function') { |
1288 // Handle function break point. | 1289 // Handle function break point. |
1289 if (!IS_STRING(target)) { | 1290 if (!IS_STRING(target)) { |
1290 response.failed('Argument "target" is not a string value'); | 1291 response.failed('Argument "target" is not a string value'); |
1291 return; | 1292 return; |
1292 } | 1293 } |
1293 var f; | 1294 var f; |
1294 try { | 1295 try { |
1295 // Find the function through a global evaluate. | 1296 // Find the function through a global evaluate. |
1296 f = this.exec_state_.evaluateGlobal(target).value(); | 1297 f = this.exec_state_.evaluateGlobal(target).value(); |
1297 } catch (e) { | 1298 } catch (e) { |
1298 response.failed('Error: "' + %ToString(e) + | 1299 response.failed('Error: "' + %ToString(e) + |
1299 '" evaluating "' + target + '"'); | 1300 '" evaluating "' + target + '"'); |
1300 return; | 1301 return; |
1301 } | 1302 } |
1302 if (!IS_FUNCTION(f)) { | 1303 if (!IS_FUNCTION(f)) { |
1303 response.failed('"' + target + '" does not evaluate to a function'); | 1304 response.failed('"' + target + '" does not evaluate to a function'); |
1304 return; | 1305 return; |
1305 } | 1306 } |
1306 | 1307 |
1307 // Set function break point. | 1308 // Set function break point. |
1308 break_point_number = Debug.setBreakPoint(f, line, column, condition); | 1309 break_point_number = Debug.setBreakPoint(f, line, column, condition); |
| 1310 } else if (type == 'handle') { |
| 1311 // Find the object pointed by the specified handle. |
| 1312 var handle = parseInt(target, 10); |
| 1313 var mirror = LookupMirror(handle); |
| 1314 if (!mirror) { |
| 1315 return response.failed('Object #' + handle + '# not found'); |
| 1316 } |
| 1317 if (!mirror.isFunction()) { |
| 1318 return response.failed('Object #' + handle + '# is not a function'); |
| 1319 } |
| 1320 |
| 1321 // Set function break point. |
| 1322 break_point_number = Debug.setBreakPoint(mirror.value(), |
| 1323 line, column, condition); |
1309 } else if (type == 'script') { | 1324 } else if (type == 'script') { |
1310 // set script break point. | 1325 // set script break point. |
1311 break_point_number = | 1326 break_point_number = |
1312 Debug.setScriptBreakPointByName(target, line, column, condition); | 1327 Debug.setScriptBreakPointByName(target, line, column, condition); |
1313 } else { // type == 'scriptId. | 1328 } else { // type == 'scriptId. |
1314 break_point_number = | 1329 break_point_number = |
1315 Debug.setScriptBreakPointById(target, line, column, condition); | 1330 Debug.setScriptBreakPointById(target, line, column, condition); |
1316 } | 1331 } |
1317 | 1332 |
1318 // Set additional break point properties. | 1333 // Set additional break point properties. |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 json += NumberToJSON_(elem); | 1869 json += NumberToJSON_(elem); |
1855 } else if (IS_STRING(elem)) { | 1870 } else if (IS_STRING(elem)) { |
1856 json += StringToJSON_(elem); | 1871 json += StringToJSON_(elem); |
1857 } else { | 1872 } else { |
1858 json += elem; | 1873 json += elem; |
1859 } | 1874 } |
1860 } | 1875 } |
1861 json += ']'; | 1876 json += ']'; |
1862 return json; | 1877 return json; |
1863 } | 1878 } |
OLD | NEW |