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 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'; |
11 import 'frame.dart'; | 11 import 'frame.dart'; |
12 import 'lazy_trace.dart'; | 12 import 'lazy_trace.dart'; |
13 import 'utils.dart'; | 13 import 'utils.dart'; |
14 import 'vm_trace.dart'; | 14 import 'vm_trace.dart'; |
15 | 15 |
16 final _terseRegExp = new RegExp(r"(-patch)?(/.*)?$"); | 16 final _terseRegExp = new RegExp(r"(-patch)?([/\\].*)?$"); |
17 | 17 |
18 /// A RegExp to match V8's stack traces. | 18 /// A RegExp to match V8's stack traces. |
19 /// | 19 /// |
20 /// V8's traces start with a line that's either just "Error" or else is a | 20 /// V8's traces start with a line that's either just "Error" or else is a |
21 /// description of the exception that occurred. That description can be multiple | 21 /// description of the exception that occurred. That description can be multiple |
22 /// lines, so we just look for any line other than the first that begins with | 22 /// lines, so we just look for any line other than the first that begins with |
23 /// three or four spaces and "at". | 23 /// three or four spaces and "at". |
24 final _v8Trace = new RegExp(r"\n ?at "); | 24 final _v8Trace = new RegExp(r"\n ?at "); |
25 | 25 |
26 /// A RegExp to match indidual lines of V8's stack traces. | 26 /// A RegExp to match indidual lines of V8's stack traces. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Figure out the longest path so we know how much to pad. | 287 // Figure out the longest path so we know how much to pad. |
288 var longest = frames.map((frame) => frame.location.length) | 288 var longest = frames.map((frame) => frame.location.length) |
289 .fold(0, math.max); | 289 .fold(0, math.max); |
290 | 290 |
291 // Print out the stack trace nicely formatted. | 291 // Print out the stack trace nicely formatted. |
292 return frames.map((frame) { | 292 return frames.map((frame) { |
293 return '${padRight(frame.location, longest)} ${frame.member}\n'; | 293 return '${padRight(frame.location, longest)} ${frame.member}\n'; |
294 }).join(); | 294 }).join(); |
295 } | 295 } |
296 } | 296 } |
OLD | NEW |