OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 7641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7652 "a = b = c = 2; \n" | 7652 "a = b = c = 2; \n" |
7653 "bar(); \n"; | 7653 "bar(); \n"; |
7654 v8::Local<v8::Value> result = PreCompileCompileRun(source); | 7654 v8::Local<v8::Value> result = PreCompileCompileRun(source); |
7655 CHECK(result->IsString()); | 7655 CHECK(result->IsString()); |
7656 v8::String::Utf8Value utf8(result); | 7656 v8::String::Utf8Value utf8(result); |
7657 CHECK_EQ("bar", *utf8); | 7657 CHECK_EQ("bar", *utf8); |
7658 | 7658 |
7659 v8::Debug::SetDebugEventListener2(NULL); | 7659 v8::Debug::SetDebugEventListener2(NULL); |
7660 CheckDebuggerUnloaded(); | 7660 CheckDebuggerUnloaded(); |
7661 } | 7661 } |
| 7662 |
| 7663 |
| 7664 static void DebugBreakStackTraceListener( |
| 7665 const v8::Debug::EventDetails& event_details) { |
| 7666 v8::StackTrace::CurrentStackTrace(CcTest::isolate(), 10); |
| 7667 } |
| 7668 |
| 7669 |
| 7670 static void AddDebugBreak(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 7671 v8::Debug::DebugBreak(args.GetIsolate()); |
| 7672 } |
| 7673 |
| 7674 |
| 7675 TEST(DebugBreakStackTrace) { |
| 7676 DebugLocalContext env; |
| 7677 v8::HandleScope scope(env->GetIsolate()); |
| 7678 v8::Debug::SetDebugEventListener2(DebugBreakStackTraceListener); |
| 7679 v8::Handle<v8::FunctionTemplate> add_debug_break_template = |
| 7680 v8::FunctionTemplate::New(env->GetIsolate(), AddDebugBreak); |
| 7681 v8::Handle<v8::Function> add_debug_break = |
| 7682 add_debug_break_template->GetFunction(); |
| 7683 env->Global()->Set(v8_str("add_debug_break"), add_debug_break); |
| 7684 |
| 7685 CompileRun("(function loop() {" |
| 7686 " for (var j = 0; j < 1000; j++) {" |
| 7687 " for (var i = 0; i < 1000; i++) {" |
| 7688 " if (i == 999) add_debug_break();" |
| 7689 " }" |
| 7690 " }" |
| 7691 "})()"); |
| 7692 } |
OLD | NEW |