Commit 41b7c560 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix remote debugger crash.

Review URL: https://chromiumcodereview.appspot.com/9200006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10449 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4f882a86
// Copyright 2011 the V8 project authors. All rights reserved. // Copyright 2012 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -310,9 +310,7 @@ void RemoteDebugger::HandleKeyboardCommand(char* command) { ...@@ -310,9 +310,7 @@ void RemoteDebugger::HandleKeyboardCommand(char* command) {
Handle<Value> request = Handle<Value> request =
Shell::DebugCommandToJSONRequest(String::New(command)); Shell::DebugCommandToJSONRequest(String::New(command));
if (try_catch.HasCaught()) { if (try_catch.HasCaught()) {
v8::String::Utf8Value exception(try_catch.Exception()); Shell::ReportException(&try_catch);
const char* exception_string = Shell::ToCString(exception);
printf("%s\n", exception_string);
PrintPrompt(); PrintPrompt();
return; return;
} }
......
...@@ -526,6 +526,8 @@ Handle<Value> Shell::Version(const Arguments& args) { ...@@ -526,6 +526,8 @@ Handle<Value> Shell::Version(const Arguments& args) {
void Shell::ReportException(v8::TryCatch* try_catch) { void Shell::ReportException(v8::TryCatch* try_catch) {
HandleScope handle_scope; HandleScope handle_scope;
bool enter_context = !Context::InContext();
if (enter_context) utility_context_->Enter();
v8::String::Utf8Value exception(try_catch->Exception()); v8::String::Utf8Value exception(try_catch->Exception());
const char* exception_string = ToCString(exception); const char* exception_string = ToCString(exception);
Handle<Message> message = try_catch->Message(); Handle<Message> message = try_catch->Message();
...@@ -560,6 +562,7 @@ void Shell::ReportException(v8::TryCatch* try_catch) { ...@@ -560,6 +562,7 @@ void Shell::ReportException(v8::TryCatch* try_catch) {
} }
} }
printf("\n"); printf("\n");
if (enter_context) utility_context_->Exit();
} }
......
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