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

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

Issue 180363003: Work around issue 17083 in pkg/stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | « no previous file | 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
50 /// A single stack frame. Each frame points to a precise location in Dart code. 59 /// A single stack frame. Each frame points to a precise location in Dart code.
51 class Frame { 60 class Frame {
52 /// The URI of the file in which the code is located. 61 /// The URI of the file in which the code is located.
53 /// 62 ///
54 /// This URI will usually have the scheme `dart`, `file`, `http`, or `https`. 63 /// This URI will usually have the scheme `dart`, `file`, `http`, or `https`.
55 final Uri uri; 64 final Uri uri;
56 65
57 /// The line number on which the code location is located. 66 /// The line number on which the code location is located.
58 /// 67 ///
59 /// This can be null, indicating that the line number is unknown or 68 /// This can be null, indicating that the line number is unknown or
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 132
124 var match = _vmFrame.firstMatch(frame); 133 var match = _vmFrame.firstMatch(frame);
125 if (match == null) { 134 if (match == null) {
126 throw new FormatException("Couldn't parse VM stack trace line '$frame'."); 135 throw new FormatException("Couldn't parse VM stack trace line '$frame'.");
127 } 136 }
128 137
129 // Get the pieces out of the regexp match. Function, URI and line should 138 // Get the pieces out of the regexp match. Function, URI and line should
130 // always be found. The column is optional. 139 // always be found. The column is optional.
131 var member = match[1].replaceAll("<anonymous closure>", "<fn>"); 140 var member = match[1].replaceAll("<anonymous closure>", "<fn>");
132 var uri = Uri.parse(match[2]); 141 var uri = Uri.parse(match[2]);
133 // Work around issue 11901. 142 if (_ioLibraries.contains(uri)) uri = Uri.parse('dart:io/${uri.path}');
134 if (uri == new Uri(path: 'timer_impl.dart')) {
135 uri = Uri.parse('dart:async/timer_impl.dart');
136 }
137 var line = int.parse(match[3]); 143 var line = int.parse(match[3]);
138 var column = null; 144 var column = null;
139 var columnMatch = match[4]; 145 var columnMatch = match[4];
140 if (columnMatch != null) { 146 if (columnMatch != null) {
141 column = int.parse(columnMatch); 147 column = int.parse(columnMatch);
142 } 148 }
143 return new Frame(uri, line, column, member); 149 return new Frame(uri, line, column, member);
144 } 150 }
145 151
146 /// Parses a string representation of a Chrome/V8 stack frame. 152 /// Parses a string representation of a Chrome/V8 stack frame.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // their stack frames. However, if we do get a relative path, we should 279 // their stack frames. However, if we do get a relative path, we should
274 // handle it gracefully. 280 // handle it gracefully.
275 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath); 281 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath);
276 return Uri.parse(uriOrPath); 282 return Uri.parse(uriOrPath);
277 } 283 }
278 284
279 Frame(this.uri, this.line, this.column, this.member); 285 Frame(this.uri, this.line, this.column, this.member);
280 286
281 String toString() => '$location in $member'; 287 String toString() => '$location in $member';
282 } 288 }
OLDNEW
« no previous file with comments | « no previous file | pkg/stack_trace/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698