Index: src/d8.cc |
=================================================================== |
--- src/d8.cc (revision 9531) |
+++ src/d8.cc (working copy) |
@@ -146,11 +146,11 @@ |
Handle<Value> name, |
bool print_result, |
bool report_exceptions) { |
-#ifndef V8_SHARED |
+#if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) |
bool FLAG_debugger = i::FLAG_debugger; |
#else |
bool FLAG_debugger = false; |
-#endif // V8_SHARED |
+#endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT |
HandleScope handle_scope; |
TryCatch try_catch; |
options.script_executed = true; |
@@ -594,6 +594,7 @@ |
Context::Scope utility_scope(utility_context_); |
#ifdef ENABLE_DEBUGGER_SUPPORT |
+ if (i::FLAG_debugger) printf("JavaScript debugger enabled\n"); |
// Install the debugger object in the utility scope |
i::Debug* debug = i::Isolate::Current()->debug(); |
debug->Load(); |
@@ -816,7 +817,7 @@ |
static FILE* FOpen(const char* path, const char* mode) { |
-#if (defined(_WIN32) || defined(_WIN64)) |
+#if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)) |
FILE* result; |
if (fopen_s(&result, path, mode) == 0) { |
return result; |
@@ -900,9 +901,6 @@ |
#ifndef V8_SHARED |
console = LineEditor::Get(); |
printf("V8 version %s [console: %s]\n", V8::GetVersion(), console->name()); |
- if (i::FLAG_debugger) { |
- printf("JavaScript debugger enabled\n"); |
- } |
console->Open(); |
while (true) { |
i::SmartArrayPointer<char> input = console->Prompt(Shell::kPrompt); |
@@ -1253,14 +1251,22 @@ |
Locker lock; |
HandleScope scope; |
Persistent<Context> context = CreateEvaluationContext(); |
+ if (options.last_run) { |
+ // Keep using the same context in the interactive shell. |
+ evaluation_context_ = context; |
+#if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) |
+ // 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 && ENABLE_DEBUGGER_SUPPORT |
+ } |
{ |
Context::Scope cscope(context); |
options.isolate_sources[0].Execute(); |
} |
- if (options.last_run) { |
- // Keep using the same context in the interactive shell |
- evaluation_context_ = context; |
- } else { |
+ if (!options.last_run) { |
context.Dispose(); |
} |
@@ -1331,9 +1337,11 @@ |
if (( options.interactive_shell |
|| !options.script_executed ) |
&& !options.test_shell ) { |
-#ifndef V8_SHARED |
- InstallUtilityScript(); |
-#endif // V8_SHARED |
+#if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT) |
+ if (!i::FLAG_debugger) { |
+ InstallUtilityScript(); |
+ } |
+#endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT |
RunShell(); |
} |