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

Side by Side Diff: pkg/stack_trace/lib/src/frame.dart

Issue 353073004: Stop working around issue 17083 in stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « pkg/stack_trace/CHANGELOG.md ('k') | pkg/stack_trace/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 frame; 5 library frame;
6 6
7 7
8 import 'package:path/path.dart' as path; 8 import 'package:path/path.dart' as path;
9 9
10 import 'trace.dart'; 10 import 'trace.dart';
(...skipping 29 matching lines...) Expand all
40 final _firefoxFrame = new RegExp( 40 final _firefoxFrame = new RegExp(
41 r'^([^@(/]*)(?:\(.*\))?((?:/[^/]*)*)(?:\(.*\))?@(.*):(\d+)$'); 41 r'^([^@(/]*)(?:\(.*\))?((?:/[^/]*)*)(?:\(.*\))?@(.*):(\d+)$');
42 42
43 // foo/bar.dart 10:11 in Foo._bar 43 // foo/bar.dart 10:11 in Foo._bar
44 // http://dartlang.org/foo/bar.dart in Foo._bar 44 // http://dartlang.org/foo/bar.dart in Foo._bar
45 final _friendlyFrame = new RegExp( 45 final _friendlyFrame = new RegExp(
46 r'^(\S+)(?: (\d+)(?::(\d+))?)?\s+([^\d]\S*)$'); 46 r'^(\S+)(?: (\d+)(?::(\d+))?)?\s+([^\d]\S*)$');
47 47
48 final _initialDot = new RegExp(r"^\."); 48 final _initialDot = new RegExp(r"^\.");
49 49
50 /// "dart:" libraries that are incorrectly reported without a "dart:" prefix.
51 ///
52 /// See issue 11901. All these libraries should be in "dart:io".
53 final _ioLibraries = new Set.from([
54 new Uri(path: 'timer_impl.dart'),
55 new Uri(path: 'http_impl.dart'),
56 new Uri(path: 'http_parser.dart')
57 ]);
58
59 /// A single stack frame. Each frame points to a precise location in Dart code. 50 /// A single stack frame. Each frame points to a precise location in Dart code.
60 class Frame { 51 class Frame {
61 /// The URI of the file in which the code is located. 52 /// The URI of the file in which the code is located.
62 /// 53 ///
63 /// This URI will usually have the scheme `dart`, `file`, `http`, or `https`. 54 /// This URI will usually have the scheme `dart`, `file`, `http`, or `https`.
64 final Uri uri; 55 final Uri uri;
65 56
66 /// The line number on which the code location is located. 57 /// The line number on which the code location is located.
67 /// 58 ///
68 /// This can be null, indicating that the line number is unknown or 59 /// This can be null, indicating that the line number is unknown or
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 119
129 var match = _vmFrame.firstMatch(frame); 120 var match = _vmFrame.firstMatch(frame);
130 if (match == null) { 121 if (match == null) {
131 throw new FormatException("Couldn't parse VM stack trace line '$frame'."); 122 throw new FormatException("Couldn't parse VM stack trace line '$frame'.");
132 } 123 }
133 124
134 // Get the pieces out of the regexp match. Function, URI and line should 125 // Get the pieces out of the regexp match. Function, URI and line should
135 // always be found. The column is optional. 126 // always be found. The column is optional.
136 var member = match[1].replaceAll("<anonymous closure>", "<fn>"); 127 var member = match[1].replaceAll("<anonymous closure>", "<fn>");
137 var uri = Uri.parse(match[2]); 128 var uri = Uri.parse(match[2]);
138 if (_ioLibraries.contains(uri)) uri = Uri.parse('dart:io/${uri.path}');
139 var line = int.parse(match[3]); 129 var line = int.parse(match[3]);
140 var column = null; 130 var column = null;
141 var columnMatch = match[4]; 131 var columnMatch = match[4];
142 if (columnMatch != null) { 132 if (columnMatch != null) {
143 column = int.parse(columnMatch); 133 column = int.parse(columnMatch);
144 } 134 }
145 return new Frame(uri, line, column, member); 135 return new Frame(uri, line, column, member);
146 } 136 }
147 137
148 /// Parses a string representation of a Chrome/V8 stack frame. 138 /// Parses a string representation of a Chrome/V8 stack frame.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // their stack frames. However, if we do get a relative path, we should 268 // their stack frames. However, if we do get a relative path, we should
279 // handle it gracefully. 269 // handle it gracefully.
280 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath); 270 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath);
281 return Uri.parse(uriOrPath); 271 return Uri.parse(uriOrPath);
282 } 272 }
283 273
284 Frame(this.uri, this.line, this.column, this.member); 274 Frame(this.uri, this.line, this.column, this.member);
285 275
286 String toString() => '$location in $member'; 276 String toString() => '$location in $member';
287 } 277 }
OLDNEW
« no previous file with comments | « pkg/stack_trace/CHANGELOG.md ('k') | pkg/stack_trace/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698