Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: src/d8.cc

Issue 14509: Added command line debugger to D8 shell.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.h ('k') | src/d8.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
===================================================================
--- src/d8.cc (revision 993)
+++ src/d8.cc (working copy)
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include "d8.h"
+#include "d8-debug.h"
#include "debug.h"
#include "api.h"
#include "natives.h"
@@ -98,6 +99,10 @@
bool report_exceptions) {
HandleScope handle_scope;
TryCatch try_catch;
+ if (i::FLAG_debugger) {
+ // When debugging make exceptions appear to be uncaught.
+ try_catch.SetVerbose(true);
+ }
Handle<Script> script = Script::Compile(source, name);
if (script.IsEmpty()) {
// Print errors that happened during compilation.
@@ -212,6 +217,46 @@
}
+Handle<String> Shell::DebugEventToText(Handle<Object> event) {
+ HandleScope handle_scope;
+ Context::Scope context_scope(utility_context_);
+ Handle<Object> global = utility_context_->Global();
+ Handle<Value> fun = global->Get(String::New("DebugEventToText"));
+ TryCatch try_catch;
+ try_catch.SetVerbose(true);
+ static const int kArgc = 1;
+ Handle<Value> argv[kArgc] = { event };
+ Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
+ if (try_catch.HasCaught()) {
+ return handle_scope.Close(try_catch.Exception()->ToString());
+ } else {
+ return handle_scope.Close(Handle<String>::Cast(val));
+ }
+}
+
+
+Handle<Value> Shell::DebugCommandToJSONRequest(Handle<String> command) {
+ Context::Scope context_scope(utility_context_);
+ Handle<Object> global = utility_context_->Global();
+ Handle<Value> fun = global->Get(String::New("DebugCommandToJSONRequest"));
+ static const int kArgc = 1;
+ Handle<Value> argv[kArgc] = { command };
+ Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
+ return val;
+}
+
+
+Handle<Object> Shell::DebugResponseDetails(Handle<String> response) {
+ Context::Scope context_scope(utility_context_);
+ Handle<Object> global = utility_context_->Global();
+ Handle<Value> fun = global->Get(String::New("DebugResponseDetails"));
+ static const int kArgc = 1;
+ Handle<Value> argv[kArgc] = { response };
+ Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
+ return Handle<Object>::Cast(val);
+}
+
+
int32_t* Counter::Bind(const char* name) {
int i;
for (i = 0; i < kMaxNameSize - 1 && name[i]; i++)
@@ -415,6 +460,8 @@
return 1;
}
}
+ if (i::FLAG_debugger)
+ v8::Debug::AddDebugEventListener(HandleDebugEvent);
if (run_shell)
RunShell();
OnExit();
« no previous file with comments | « src/d8.h ('k') | src/d8.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698