Reviewers: antonm,

Description:
Add stack traces to mjsunit tests.

Please review this at http://codereview.chromium.org/2094005/show

Affected files:
  M samples/shell.cc
  M test/mjsunit/mjsunit.js


Index: samples/shell.cc
diff --git a/samples/shell.cc b/samples/shell.cc
index 27ed293e7ec6e68ee673d1f0b0b8ed9158489023..1a13f5f80bff11979c5fdf55cbdebc888ca36825 100644
--- a/samples/shell.cc
+++ b/samples/shell.cc
@@ -299,5 +299,10 @@ void ReportException(v8::TryCatch* try_catch) {
       printf("^");
     }
     printf("\n");
+    v8::String::Utf8Value stack_trace(try_catch->StackTrace());
+    if (stack_trace.length() > 0) {
+      const char* stack_trace_string = ToCString(stack_trace);
+      printf("%s\n", stack_trace_string);
+    }
   }
 }
Index: test/mjsunit/mjsunit.js
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js
index 07c4e7eff37566333c9ad2116b6e02e8abae65f4..558282f52bb39126003503fac3aedeb94f27ecff 100644
--- a/test/mjsunit/mjsunit.js
+++ b/test/mjsunit/mjsunit.js
@@ -27,6 +27,8 @@

 function MjsUnitAssertionError(message) {
   this.message = message;
+  // This allows fetching the stack trace using TryCatch::StackTrace.
+  this.stack = new Error("").stack;
 }

 MjsUnitAssertionError.prototype.toString = function () {


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to