OLD | NEW |
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 import 'package:path/path.dart' as path; | 7 import 'package:path/path.dart' as path; |
8 | 8 |
9 import 'trace.dart'; | 9 import 'trace.dart'; |
10 | 10 |
11 // #1 Foo._bar (file:///home/nweiz/code/stuff.dart:42:21) | 11 // #1 Foo._bar (file:///home/nweiz/code/stuff.dart:42:21) |
12 // #1 Foo._bar (file:///home/nweiz/code/stuff.dart:42) | 12 // #1 Foo._bar (file:///home/nweiz/code/stuff.dart:42) |
13 // #1 Foo._bar (file:///home/nweiz/code/stuff.dart) | 13 // #1 Foo._bar (file:///home/nweiz/code/stuff.dart) |
14 final _vmFrame = new RegExp(r'^#\d+\s+(\S.*) \((.+?)((?::\d+){0,2})\)$'); | 14 final _vmFrame = new RegExp(r'^#\d+\s+(\S.*) \((.+?)((?::\d+){0,2})\)$'); |
15 | 15 |
| 16 // at Object.stringify (native) |
16 // at VW.call$0 (http://pub.dartlang.org/stuff.dart.js:560:28) | 17 // at VW.call$0 (http://pub.dartlang.org/stuff.dart.js:560:28) |
17 // at VW.call$0 (eval as fn | 18 // at VW.call$0 (eval as fn |
18 // (http://pub.dartlang.org/stuff.dart.js:560:28), efn:3:28) | 19 // (http://pub.dartlang.org/stuff.dart.js:560:28), efn:3:28) |
19 // at http://pub.dartlang.org/stuff.dart.js:560:28 | 20 // at http://pub.dartlang.org/stuff.dart.js:560:28 |
20 final _v8Frame = new RegExp( | 21 final _v8Frame = new RegExp( |
21 r'^\s*at (?:(\S.*?)(?: \[as [^\]]+\])? \((.*)\)|(.*))$'); | 22 r'^\s*at (?:(\S.*?)(?: \[as [^\]]+\])? \((.*)\)|(.*))$'); |
22 | 23 |
23 // http://pub.dartlang.org/stuff.dart.js:560:28 | 24 // http://pub.dartlang.org/stuff.dart.js:560:28 |
24 final _v8UrlLocation = new RegExp(r'^(.*):(\d+):(\d+)$'); | 25 final _v8UrlLocation = new RegExp(r'^(.*):(\d+):(\d+)|native$'); |
25 | 26 |
26 // eval as function (http://pub.dartlang.org/stuff.dart.js:560:28), efn:3:28 | 27 // eval as function (http://pub.dartlang.org/stuff.dart.js:560:28), efn:3:28 |
27 // eval as function (http://pub.dartlang.org/stuff.dart.js:560:28) | 28 // eval as function (http://pub.dartlang.org/stuff.dart.js:560:28) |
28 // eval as function (eval as otherFunction | 29 // eval as function (eval as otherFunction |
29 // (http://pub.dartlang.org/stuff.dart.js:560:28)) | 30 // (http://pub.dartlang.org/stuff.dart.js:560:28)) |
30 final _v8EvalLocation = new RegExp( | 31 final _v8EvalLocation = new RegExp( |
31 r'^eval at (?:\S.*?) \((.*)\)(?:, .*?:\d+:\d+)?$'); | 32 r'^eval at (?:\S.*?) \((.*)\)(?:, .*?:\d+:\d+)?$'); |
32 | 33 |
33 // .VW.call$0@http://pub.dartlang.org/stuff.dart.js:560 | 34 // .VW.call$0@http://pub.dartlang.org/stuff.dart.js:560 |
34 // .VW.call$0("arg")@http://pub.dartlang.org/stuff.dart.js:560 | 35 // .VW.call$0("arg")@http://pub.dartlang.org/stuff.dart.js:560 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 160 |
160 // v8 location strings can be arbitrarily-nested, since it adds a layer of | 161 // v8 location strings can be arbitrarily-nested, since it adds a layer of |
161 // nesting for each eval performed on that line. | 162 // nesting for each eval performed on that line. |
162 parseLocation(location, member) { | 163 parseLocation(location, member) { |
163 var evalMatch = _v8EvalLocation.firstMatch(location); | 164 var evalMatch = _v8EvalLocation.firstMatch(location); |
164 while (evalMatch != null) { | 165 while (evalMatch != null) { |
165 location = evalMatch[1]; | 166 location = evalMatch[1]; |
166 evalMatch = _v8EvalLocation.firstMatch(location); | 167 evalMatch = _v8EvalLocation.firstMatch(location); |
167 } | 168 } |
168 | 169 |
| 170 if (location == 'native') { |
| 171 return new Frame(Uri.parse('native'), null, null, member); |
| 172 } |
| 173 |
169 var urlMatch = _v8UrlLocation.firstMatch(location); | 174 var urlMatch = _v8UrlLocation.firstMatch(location); |
170 if (urlMatch == null) { | 175 if (urlMatch == null) { |
171 throw new FormatException( | 176 throw new FormatException( |
172 "Couldn't parse V8 stack trace line '$frame'."); | 177 "Couldn't parse V8 stack trace line '$frame'."); |
173 } | 178 } |
174 | 179 |
175 return new Frame( | 180 return new Frame( |
176 _uriOrPathToUri(urlMatch[1]), | 181 _uriOrPathToUri(urlMatch[1]), |
177 int.parse(urlMatch[2]), | 182 int.parse(urlMatch[2]), |
178 int.parse(urlMatch[3]), | 183 int.parse(urlMatch[3]), |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 // their stack frames. However, if we do get a relative path, we should | 291 // their stack frames. However, if we do get a relative path, we should |
287 // handle it gracefully. | 292 // handle it gracefully. |
288 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath); | 293 if (uriOrPath.contains('\\')) return path.windows.toUri(uriOrPath); |
289 return Uri.parse(uriOrPath); | 294 return Uri.parse(uriOrPath); |
290 } | 295 } |
291 | 296 |
292 Frame(this.uri, this.line, this.column, this.member); | 297 Frame(this.uri, this.line, this.column, this.member); |
293 | 298 |
294 String toString() => '$location in $member'; | 299 String toString() => '$location in $member'; |
295 } | 300 } |
OLD | NEW |