| Index: src/d8-debug.cc
|
| ===================================================================
|
| --- src/d8-debug.cc (revision 4430)
|
| +++ src/d8-debug.cc (working copy)
|
| @@ -34,7 +34,12 @@
|
|
|
| namespace v8 {
|
|
|
| +void PrintPrompt() {
|
| + printf("dbg> ");
|
| + fflush(stdout);
|
| +}
|
|
|
| +
|
| void HandleDebugEvent(DebugEvent event,
|
| Handle<Object> exec_state,
|
| Handle<Object> event_data,
|
| @@ -86,7 +91,7 @@
|
| bool running = false;
|
| while (!running) {
|
| char command[kBufferSize];
|
| - printf("dbg> ");
|
| + PrintPrompt();
|
| char* str = fgets(command, kBufferSize, stdin);
|
| if (str == NULL) break;
|
|
|
| @@ -178,6 +183,7 @@
|
| // Start the keyboard thread.
|
| KeyboardThread keyboard(this);
|
| keyboard.Start();
|
| + PrintPrompt();
|
|
|
| // Process events received from debugged VM and from the keyboard.
|
| bool terminate = false;
|
| @@ -264,7 +270,8 @@
|
| Handle<Object> details =
|
| Shell::DebugMessageDetails(Handle<String>::Cast(String::New(message)));
|
| if (try_catch.HasCaught()) {
|
| - Shell::ReportException(&try_catch);
|
| + Shell::ReportException(&try_catch);
|
| + PrintPrompt();
|
| return;
|
| }
|
| String::Utf8Value str(details->Get(String::New("text")));
|
| @@ -277,7 +284,7 @@
|
| } else {
|
| printf("???\n");
|
| }
|
| - printf("dbg> ");
|
| + PrintPrompt();
|
| }
|
|
|
|
|
| @@ -289,13 +296,17 @@
|
| Handle<Value> request =
|
| Shell::DebugCommandToJSONRequest(String::New(command));
|
| if (try_catch.HasCaught()) {
|
| - Shell::ReportException(&try_catch);
|
| + v8::String::Utf8Value exception(try_catch.Exception());
|
| + const char* exception_string = Shell::ToCString(exception);
|
| + printf("%s\n", exception_string);
|
| + PrintPrompt();
|
| return;
|
| }
|
|
|
| // If undefined is returned the command was handled internally and there is
|
| // no JSON to send.
|
| if (request->IsUndefined()) {
|
| + PrintPrompt();
|
| return;
|
| }
|
|
|
|
|