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

Unified Diff: lib/src/trace.dart

Issue 1062123003: Support JavaScriptCore stack traces. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Better implementation Created 5 years, 8 months 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 | « lib/src/frame.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/trace.dart
diff --git a/lib/src/trace.dart b/lib/src/trace.dart
index 954cf453e9020a87073d513bf134010286d50a7e..e7462574d9bfc2d390e93b4201dba7e71dc68c22 100644
--- a/lib/src/trace.dart
+++ b/lib/src/trace.dart
@@ -13,6 +13,8 @@ import 'lazy_trace.dart';
import 'utils.dart';
import 'vm_trace.dart';
+import 'dart:convert';
+
final _terseRegExp = new RegExp(r"(-patch)?(/.*)?$");
/// A RegExp to match V8's stack traces.
@@ -115,6 +117,7 @@ class Trace implements StackTrace {
try {
if (trace.isEmpty) return new Trace(<Frame>[]);
if (trace.contains(_v8Trace)) return new Trace.parseV8(trace);
+ if (trace.startsWith("\tat ")) return new Trace.parseJSCore(trace);
if (trace.contains(_firefoxSafariTrace)) {
return new Trace.parseFirefox(trace);
}
@@ -127,6 +130,7 @@ class Trace implements StackTrace {
// 11257).
return new Trace.parseVM(trace);
} on FormatException catch (error) {
+ print(JSON.encode(trace));
kevmoo 2015/04/13 23:25:47 Oops?
nweiz 2015/04/13 23:27:19 Done.
throw new FormatException('${error.message}\nStack trace:\n$trace');
}
}
@@ -147,6 +151,10 @@ class Trace implements StackTrace {
.skipWhile((line) => !line.startsWith(_v8TraceLine))
.map((line) => new Frame.parseV8(line)));
+ /// Parses a string representation of a JavaScriptCore stack trace.
+ Trace.parseJSCore(String trace)
+ : this(trace.split("\n").map((line) => new Frame.parseV8(line)));
+
/// Parses a string representation of an Internet Explorer stack trace.
///
/// IE10+ traces look just like V8 traces. Prior to IE10, stack traces can't
« no previous file with comments | « lib/src/frame.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698