Commit 91834448 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Turn on d8 interactive debugging before running files passed on the command line

If the file test.js contains:

  function f() { debugger; }
  f()

Then running

  $ d8 --debugger test.js

will now hit the breakpoint in f which it would not before.

R=yangguo@chromium.org

BUG=
TEST=

Review URL: http://codereview.chromium.org//7981023

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9366 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fdaadb78
...@@ -1253,14 +1253,22 @@ int Shell::RunMain(int argc, char* argv[]) { ...@@ -1253,14 +1253,22 @@ int Shell::RunMain(int argc, char* argv[]) {
Locker lock; Locker lock;
HandleScope scope; HandleScope scope;
Persistent<Context> context = CreateEvaluationContext(); Persistent<Context> context = CreateEvaluationContext();
if (options.last_run) {
// Keep using the same context in the interactive shell.
evaluation_context_ = context;
#ifndef V8_SHARED
// If the interactive debugger is enabled make sure to activate
// it before running the files passed on the command line.
if (i::FLAG_debugger) {
InstallUtilityScript();
}
#endif // V8_SHARED
}
{ {
Context::Scope cscope(context); Context::Scope cscope(context);
options.isolate_sources[0].Execute(); options.isolate_sources[0].Execute();
} }
if (options.last_run) { if (!options.last_run) {
// Keep using the same context in the interactive shell
evaluation_context_ = context;
} else {
context.Dispose(); context.Dispose();
} }
...@@ -1332,7 +1340,9 @@ int Shell::Main(int argc, char* argv[]) { ...@@ -1332,7 +1340,9 @@ int Shell::Main(int argc, char* argv[]) {
|| !options.script_executed ) || !options.script_executed )
&& !options.test_shell ) { && !options.test_shell ) {
#ifndef V8_SHARED #ifndef V8_SHARED
InstallUtilityScript(); if (!i::FLAG_debugger) {
InstallUtilityScript();
}
#endif // V8_SHARED #endif // V8_SHARED
RunShell(); RunShell();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment