Added context sensitive prompt for remote debugger. It now shows "> "

when the debuggee is running, and "dbg> " when the debuggee is stopped.

Patch by Mark Lam from Hewlett-Packard Development Company, LP

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6126 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
sgjesse@chromium.org 2011-01-03 07:56:30 +00:00
parent 0a128e5ae7
commit cbfcef150a

View File

@ -34,12 +34,21 @@
namespace v8 {
void PrintPrompt() {
printf("dbg> ");
static bool was_running = true;
void PrintPrompt(bool is_running) {
const char* prompt = is_running? "> " : "dbg> ";
was_running = is_running;
printf("%s", prompt);
fflush(stdout);
}
void PrintPrompt() {
PrintPrompt(was_running);
}
void HandleDebugEvent(DebugEvent event,
Handle<Object> exec_state,
Handle<Object> event_data,
@ -91,7 +100,7 @@ void HandleDebugEvent(DebugEvent event,
bool running = false;
while (!running) {
char command[kBufferSize];
PrintPrompt();
PrintPrompt(running);
char* str = fgets(command, kBufferSize, stdin);
if (str == NULL) break;
@ -284,7 +293,9 @@ void RemoteDebugger::HandleMessageReceived(char* message) {
} else {
printf("???\n");
}
PrintPrompt();
bool is_running = details->Get(String::New("running"))->ToBoolean()->Value();
PrintPrompt(is_running);
}