OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3560 | 3560 |
3561 | 3561 |
3562 // We match parts of the message to get evaluate result int value. | 3562 // We match parts of the message to get evaluate result int value. |
3563 int GetEvaluateIntResult(char *message) { | 3563 int GetEvaluateIntResult(char *message) { |
3564 const char* value = "\"value\":"; | 3564 const char* value = "\"value\":"; |
3565 char* pos = strstr(message, value); | 3565 char* pos = strstr(message, value); |
3566 if (pos == NULL) { | 3566 if (pos == NULL) { |
3567 return -1; | 3567 return -1; |
3568 } | 3568 } |
3569 int res = -1; | 3569 int res = -1; |
3570 sscanf(pos + strlen(value), "%d", &res); | 3570 res = atoi(pos + strlen(value)); |
3571 return res; | 3571 return res; |
3572 } | 3572 } |
3573 | 3573 |
3574 | 3574 |
3575 // We match parts of the message to get hit breakpoint id. | 3575 // We match parts of the message to get hit breakpoint id. |
3576 int GetBreakpointIdFromBreakEventMessage(char *message) { | 3576 int GetBreakpointIdFromBreakEventMessage(char *message) { |
3577 const char* breakpoints = "\"breakpoints\":["; | 3577 const char* breakpoints = "\"breakpoints\":["; |
3578 char* pos = strstr(message, breakpoints); | 3578 char* pos = strstr(message, breakpoints); |
3579 if (pos == NULL) { | 3579 if (pos == NULL) { |
3580 return -1; | 3580 return -1; |
3581 } | 3581 } |
3582 int res = -1; | 3582 int res = -1; |
3583 sscanf(pos + strlen(breakpoints), "%d", &res); | 3583 res = atoi(pos + strlen(breakpoints)); |
3584 return res; | 3584 return res; |
3585 } | 3585 } |
3586 | 3586 |
3587 | 3587 |
3588 /* Test MessageQueues */ | 3588 /* Test MessageQueues */ |
3589 /* Tests the message queues that hold debugger commands and | 3589 /* Tests the message queues that hold debugger commands and |
3590 * response messages to the debugger. Fills queues and makes | 3590 * response messages to the debugger. Fills queues and makes |
3591 * them grow. | 3591 * them grow. |
3592 */ | 3592 */ |
3593 Barriers message_queue_barriers; | 3593 Barriers message_queue_barriers; |
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5437 v8::Script::New( | 5437 v8::Script::New( |
5438 v8::String::New( | 5438 v8::String::New( |
5439 "function runTest(mirror) {" | 5439 "function runTest(mirror) {" |
5440 " return mirror.isString() && (mirror.length() == 5);" | 5440 " return mirror.isString() && (mirror.length() == 5);" |
5441 "}" | 5441 "}" |
5442 "" | 5442 "" |
5443 "runTest;"))->Run()); | 5443 "runTest;"))->Run()); |
5444 v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj); | 5444 v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj); |
5445 CHECK(result->IsTrue()); | 5445 CHECK(result->IsTrue()); |
5446 } | 5446 } |
OLD | NEW |