OLD | NEW |
1 This library provides the ability to parse, inspect, and manipulate stack traces | 1 This library provides the ability to parse, inspect, and manipulate stack traces |
2 produced by the underlying Dart implementation. It also provides functions to | 2 produced by the underlying Dart implementation. It also provides functions to |
3 produce string representations of stack traces in a more readable format than | 3 produce string representations of stack traces in a more readable format than |
4 the native [StackTrace] implementation. | 4 the native [StackTrace] implementation. |
5 | 5 |
6 `Trace`s can be parsed from native [StackTrace]s using `Trace.from`, or captured | 6 `Trace`s can be parsed from native [StackTrace]s using `Trace.from`, or captured |
7 using `Trace.current`. Native [StackTrace]s can also be directly converted to | 7 using `Trace.current`. Native [StackTrace]s can also be directly converted to |
8 human-readable strings using `Trace.format`. | 8 human-readable strings using `Trace.format`. |
9 | 9 |
10 [StackTrace]: http://api.dartlang.org/docs/releases/latest/dart_core/StackTrace.
html | 10 [StackTrace]: https://api.dartlang.org/stable/dart-core/StackTrace-class.html |
11 | 11 |
12 Here's an example native stack trace from debugging this library: | 12 Here's an example native stack trace from debugging this library: |
13 | 13 |
14 #0 Object.noSuchMethod (dart:core-patch:1884:25) | 14 #0 Object.noSuchMethod (dart:core-patch:1884:25) |
15 #1 Trace.terse.<anonymous closure> (file:///usr/local/google-old/home/g
oog/dart/dart/pkg/stack_trace/lib/src/trace.dart:47:21) | 15 #1 Trace.terse.<anonymous closure> (file:///usr/local/google-old/home/g
oog/dart/dart/pkg/stack_trace/lib/src/trace.dart:47:21) |
16 #2 IterableMixinWorkaround.reduce (dart:collection:29:29) | 16 #2 IterableMixinWorkaround.reduce (dart:collection:29:29) |
17 #3 List.reduce (dart:core-patch:1247:42) | 17 #3 List.reduce (dart:core-patch:1247:42) |
18 #4 Trace.terse (file:///usr/local/google-old/home/goog/dart/dart/pkg/st
ack_trace/lib/src/trace.dart:40:35) | 18 #4 Trace.terse (file:///usr/local/google-old/home/goog/dart/dart/pkg/st
ack_trace/lib/src/trace.dart:40:35) |
19 #5 format (file:///usr/local/google-old/home/goog/dart/dart/pkg/stack_t
race/lib/stack_trace.dart:24:28) | 19 #5 format (file:///usr/local/google-old/home/goog/dart/dart/pkg/stack_t
race/lib/stack_trace.dart:24:28) |
20 #6 main.<anonymous closure> (file:///usr/local/google-old/home/goog/dar
t/dart/test.dart:21:29) | 20 #6 main.<anonymous closure> (file:///usr/local/google-old/home/goog/dar
t/dart/test.dart:21:29) |
21 #7 _CatchErrorFuture._sendError (dart:async:525:24) | 21 #7 _CatchErrorFuture._sendError (dart:async:525:24) |
22 #8 _FutureImpl._setErrorWithoutAsyncTrace (dart:async:393:26) | 22 #8 _FutureImpl._setErrorWithoutAsyncTrace (dart:async:393:26) |
23 #9 _FutureImpl._setError (dart:async:378:31) | 23 #9 _FutureImpl._setError (dart:async:378:31) |
24 #10 _ThenFuture._sendValue (dart:async:490:16) | 24 #10 _ThenFuture._sendValue (dart:async:490:16) |
25 #11 _FutureImpl._handleValue.<anonymous closure> (dart:async:349:28) | 25 #11 _FutureImpl._handleValue.<anonymous closure> (dart:async:349:28) |
26 #12 Timer.run.<anonymous closure> (dart:async:2402:21) | 26 #12 Timer.run.<anonymous closure> (dart:async:2402:21) |
27 #13 Timer.Timer.<anonymous closure> (dart:async-patch:15:15) | 27 #13 Timer.Timer.<anonymous closure> (dart:async-patch:15:15) |
28 | 28 |
29 and its human-readable representation: | 29 and its human-readable representation: |
30 | 30 |
31 dart:core-patch Object.noSuchMethod | 31 dart:core-patch 1884:25 Object.noSuchMethod |
32 pkg/stack_trace/lib/src/trace.dart 47:21 Trace.terse.<fn> | 32 pkg/stack_trace/lib/src/trace.dart 47:21 Trace.terse.<fn> |
33 dart:collection IterableMixinWorkaround.reduce | 33 dart:collection 29:29 IterableMixinWorkaround.reduce |
34 dart:core-patch List.reduce | 34 dart:core-patch 1247:42 List.reduce |
35 pkg/stack_trace/lib/src/trace.dart 40:35 Trace.terse | 35 pkg/stack_trace/lib/src/trace.dart 40:35 Trace.terse |
36 pkg/stack_trace/lib/stack_trace.dart 24:28 format | 36 pkg/stack_trace/lib/stack_trace.dart 24:28 format |
37 test.dart 21:29 main.<fn> | 37 test.dart 21:29 main.<fn> |
38 dart:async _CatchErrorFuture._sendError | 38 dart:async 525:24 _CatchErrorFuture._sendError |
39 dart:async _FutureImpl._setErrorWithoutAsyn
cTrace | 39 dart:async 393:26 _FutureImpl._setErrorWithoutAsyn
cTrace |
40 dart:async _FutureImpl._setError | 40 dart:async 378:31 _FutureImpl._setError |
41 dart:async _ThenFuture._sendValue | 41 dart:async 490:16 _ThenFuture._sendValue |
42 dart:async _FutureImpl._handleValue.<fn> | 42 dart:async 349:28 _FutureImpl._handleValue.<fn> |
43 dart:async Timer.run.<fn> | 43 dart:async 2402:21 Timer.run.<fn> |
44 dart:async-patch Timer.Timer.<fn> | 44 dart:async-patch 15:15 Timer.Timer.<fn> |
45 | 45 |
46 You can further clean up the stack trace using `Trace.terse`. This folds | 46 You can further clean up the stack trace using `Trace.terse`. This folds |
47 together multiple stack frames from the Dart core libraries, so that only the | 47 together multiple stack frames from the Dart core libraries, so that only the |
48 core library method that was directly called from user code is visible. For | 48 core library method that was directly called from user code is visible. For |
49 example: | 49 example: |
50 | 50 |
51 dart:core Object.noSuchMethod | 51 dart:core Object.noSuchMethod |
52 pkg/stack_trace/lib/src/trace.dart 47:21 Trace.terse.<fn> | 52 pkg/stack_trace/lib/src/trace.dart 47:21 Trace.terse.<fn> |
53 dart:core List.reduce | 53 dart:core List.reduce |
54 pkg/stack_trace/lib/src/trace.dart 40:35 Trace.terse | 54 pkg/stack_trace/lib/src/trace.dart 40:35 Trace.terse |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 test.dart 13:28 scheduleAsync.<fn> | 195 test.dart 13:28 scheduleAsync.<fn> |
196 ===== asynchronous gap =========================== | 196 ===== asynchronous gap =========================== |
197 dart:async _Future.then | 197 dart:async _Future.then |
198 test.dart 13:12 scheduleAsync | 198 test.dart 13:12 scheduleAsync |
199 test.dart 7:18 main.<fn> | 199 test.dart 7:18 main.<fn> |
200 package:stack_trace Chain.capture | 200 package:stack_trace Chain.capture |
201 test.dart 6:16 main | 201 test.dart 6:16 main |
202 | 202 |
203 That's a lot easier to understand! | 203 That's a lot easier to understand! |
204 | 204 |
205 [Zone]: https://api.dartlang.org/apidocs/channels/stable/#dart-async.Zone | 205 [Zone]: https://api.dartlang.org/stable/dart-async/Zone-class.html |
OLD | NEW |