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

Side by Side Diff: lib/src/trace.dart

Issue 1080083004: Support more types of JavaScriptCore stack frames. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library trace; 5 library trace;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'chain.dart'; 10 import 'chain.dart';
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 Trace.parseV8(String trace) 143 Trace.parseV8(String trace)
144 : this(trace.split("\n").skip(1) 144 : this(trace.split("\n").skip(1)
145 // It's possible that an Exception's description contains a line that 145 // It's possible that an Exception's description contains a line that
146 // looks like a V8 trace line, which will screw this up. 146 // looks like a V8 trace line, which will screw this up.
147 // Unfortunately, that's impossible to detect. 147 // Unfortunately, that's impossible to detect.
148 .skipWhile((line) => !line.startsWith(_v8TraceLine)) 148 .skipWhile((line) => !line.startsWith(_v8TraceLine))
149 .map((line) => new Frame.parseV8(line))); 149 .map((line) => new Frame.parseV8(line)));
150 150
151 /// Parses a string representation of a JavaScriptCore stack trace. 151 /// Parses a string representation of a JavaScriptCore stack trace.
152 Trace.parseJSCore(String trace) 152 Trace.parseJSCore(String trace)
153 : this(trace.split("\n").map((line) => new Frame.parseV8(line))); 153 : this(trace.split("\n")
154 .where((line) => line != "\tat ")
155 .map((line) => new Frame.parseV8(line)));
154 156
155 /// Parses a string representation of an Internet Explorer stack trace. 157 /// Parses a string representation of an Internet Explorer stack trace.
156 /// 158 ///
157 /// IE10+ traces look just like V8 traces. Prior to IE10, stack traces can't 159 /// IE10+ traces look just like V8 traces. Prior to IE10, stack traces can't
158 /// be retrieved. 160 /// be retrieved.
159 Trace.parseIE(String trace) 161 Trace.parseIE(String trace)
160 : this.parseV8(trace); 162 : this.parseV8(trace);
161 163
162 /// Parses a string representation of a Firefox stack trace. 164 /// Parses a string representation of a Firefox stack trace.
163 Trace.parseFirefox(String trace) 165 Trace.parseFirefox(String trace)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // Figure out the longest path so we know how much to pad. 274 // Figure out the longest path so we know how much to pad.
273 var longest = frames.map((frame) => frame.location.length) 275 var longest = frames.map((frame) => frame.location.length)
274 .fold(0, math.max); 276 .fold(0, math.max);
275 277
276 // Print out the stack trace nicely formatted. 278 // Print out the stack trace nicely formatted.
277 return frames.map((frame) { 279 return frames.map((frame) {
278 return '${padRight(frame.location, longest)} ${frame.member}\n'; 280 return '${padRight(frame.location, longest)} ${frame.member}\n';
279 }).join(); 281 }).join();
280 } 282 }
281 } 283 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698