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

Side by Side Diff: test/cctest/test-debug.cc

Issue 10695173: Merged r12019 into 3.11 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.11
Patch Set: Created 8 years, 5 months 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 | « src/version.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7332 matching lines...) Expand 10 before | Expand all | Expand 10 after
7343 "g(false); \n" 7343 "g(false); \n"
7344 "g(false); \n" 7344 "g(false); \n"
7345 "%OptimizeFunctionOnNextCall(g); \n" 7345 "%OptimizeFunctionOnNextCall(g); \n"
7346 "g(true);"; 7346 "g(true);";
7347 v8::Debug::SetDebugEventListener(DebugBreakInlineListener); 7347 v8::Debug::SetDebugEventListener(DebugBreakInlineListener);
7348 inline_script = v8::Script::Compile(v8::String::New(source)); 7348 inline_script = v8::Script::Compile(v8::String::New(source));
7349 inline_script->Run(); 7349 inline_script->Run();
7350 } 7350 }
7351 7351
7352 7352
7353 static void DebugEventStepNext(v8::DebugEvent event,
7354 v8::Handle<v8::Object> exec_state,
7355 v8::Handle<v8::Object> event_data,
7356 v8::Handle<v8::Value> data) {
7357 if (event == v8::Break) {
7358 PrepareStep(StepNext);
7359 }
7360 }
7361
7362
7363 static void RunScriptInANewCFrame(const char* source) {
7364 v8::TryCatch try_catch;
7365 CompileRun(source);
7366 CHECK(try_catch.HasCaught());
7367 }
7368
7369
7370 TEST(Regress131642) {
7371 // Bug description:
7372 // When doing StepNext through the first script, the debugger is not reset
7373 // after exiting through exception. A flawed implementation enabling the
7374 // debugger to step into Array.prototype.forEach breaks inside the callback
7375 // for forEach in the second script under the assumption that we are in a
7376 // recursive call. In an attempt to step out, we crawl the stack using the
7377 // recorded frame pointer from the first script and fail when not finding it
7378 // on the stack.
7379 v8::HandleScope scope;
7380 DebugLocalContext env;
7381 v8::Debug::SetDebugEventListener(DebugEventStepNext);
7382
7383 // We step through the first script. It exits through an exception. We run
7384 // this inside a new frame to record a different FP than the second script
7385 // would expect.
7386 const char* script_1 = "debugger; throw new Error();";
7387 RunScriptInANewCFrame(script_1);
7388
7389 // The second script uses forEach.
7390 const char* script_2 = "[0].forEach(function() { });";
7391 CompileRun(script_2);
7392
7393 v8::Debug::SetDebugEventListener(NULL);
7394 }
7395
7353 #endif // ENABLE_DEBUGGER_SUPPORT 7396 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « src/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698