Commit Graph

20 Commits

Author SHA1 Message Date
John McCutchan 2c52f8423d Fix missing top frame in exception stacks in product mode
BUG=

Review-Url: https://codereview.chromium.org/2688783002 .
2017-02-09 16:11:22 -08:00
John McCutchan a0ee5b24db Track async causal stack traces
This CL improves the stack traces that accompany exceptions. Whenever an
async function is entered, we remember how we got there. This is similar
in spirit to package:stack_trace but the implementation is more efficient
and memory usage can be more easily reasoned about.

Tracking causal stack traces:

- [x] Upon entry to an async function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Upon entry to an async* function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Before returning from an async function, clear the Thread's asynchronous stack trace.
- [x] After resuming an async function, load the sychronous stack trace prefix into the Thread.
- [x] Filter stack traces to remove async machinery.

Service protocol changes:

- [x] Send causal async stack trace.

Observatory changes:

- [x] Display causal async stack trace below async functions.

Fixes https://github.com/dart-lang/sdk/issues/27661

R=asiva@google.com, rmacnak@google.com

Comparisons: https://docs.google.com/a/google.com/document/d/10r6jEqr8OCiDZ4y9SYU_uOimcHiOGAZMly2ghTErALI/edit?usp=sharing
Review-Url: https://codereview.chromium.org/2646443005 .
2017-02-09 15:39:44 -08:00
John McCutchan f125cc7d0b Improve the casing of Stackmap and Stacktrace.
- [x] Stackmap -> StackMap
- [x] Stacktrace -> StackTrace

This makes us consistent with the Dart language (StackTrace) and
corrects the casing of StackMap.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2572563004 .
2016-12-12 14:51:30 -08:00
Zachary Anderson 2e4dfd3a2d clang-format runtime/lib
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2468093007 .
2016-11-04 12:14:41 -07:00
Ryan Macnak 7ff2dd4117 Optimize AOT's switchable calls for the monomorphic case.
The call sequence is very similar to a classic IC call, except the guarded class and the target are loaded indirectly from the constant pool instead of as immediates. In the monomorphic case, we call directly to the expected target with a class check in the callee. In the unlinked, polymorphic and megamorphic cases, we call a stub; these case are now call-through instead of call-and-return.

Every code, except stubs involved in switchable calls, includes the class check sequence at the beginning. So we now distinguish between a checked and an unchecked entry point. Generated code except the switchable call continues to use the unchecked entry point.

PC offsets are calculated relative to the beginning of the instruction stream, rather than either entry point.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2226893002 .
2016-08-12 11:18:35 -07:00
Ryan Macnak 524fbc1e0f Use clustered serialization for full snapshots.
Retain the recursive-descent format for script and message snapshots.

Flutter gallery app on a Nexus 4
 - Snapshot, excluding instruction/rodata sections 3429177 -> 2874997B (-16%)
 - InitOnce 54.1 -> 8.4ms (-84%)
 - InitializeIsolate 374.3 -> 170.8ms (-54%)

R=asiva@google.com

Review URL: https://codereview.chromium.org/2032153003 .
2016-06-29 19:50:06 -07:00
Todd Turnidge 2232a52ff8 Print stack trace when Dart_SetReturnValue is passed UnwindError.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1652873004 .
2016-02-01 10:46:49 -08:00
Lasse R.H. Nielsen 027b8dca39 Add StackTrace.current getter.
R=floitsch@google.com, iposva@google.com, sra@google.com

Review URL: https://codereview.chromium.org/1448003002.
2015-11-24 08:26:03 +01:00
iposva@google.com ebabd58de8 - Add a _fatal helper function into dart:core, so that we can
abort if we get into an unrecoverable state in the core library.

R=hausner@google.com

Review URL: https://codereview.chromium.org//953973003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44010 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-24 23:27:56 +00:00
iposva@google.com db9faebe98 - Simplify collection of stack traces. If we determine that a stack
trace is needed we collect the full stack trace instead of piecing
  it together as we walk up the stack.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//939773003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43863 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-19 02:18:53 +00:00
iposva@google.com 98e0500c87 - Remove obsolete stack trace functions.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//933623003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43802 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-16 22:53:19 +00:00
rmacnak@google.com db79e9cca6 Rename is_visible to is_reflectable; use is_debuggable instead of is_reflectable to decide whether to filter a frame from stack traces.
Merge verbose_stacktrace flag into show_hidden_frames.

Don't mark native functions as non-debuggable (breakpoints don't actually work there now but nothing goes wrong).

BUG=

Review URL: https://codereview.chromium.org//868453002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43121 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-23 21:16:40 +00:00
jacobr@google.com 8fd3f6a789 Workaround stacktrace crasher bug in the VM.
Fix for bug setting breakpoint after app reload.

BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//254683003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35401 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-24 20:34:19 +00:00
srdjan@google.com e3ce299913 Traverse inlined frames lazily when printing the stacktrace. No need to carry separate function and code array, since function can always be extracted from code.
R=asiva@google.com

Review URL: https://codereview.chromium.org//23964003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27209 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-05 20:25:00 +00:00
asiva@google.com d6aaf0cc94 1. Add flag --trace-api to trace API function invocation
2. Add tracing of external native functions under --trace-natives flag
3. Added a _printCurrentStacktrace() function so that one could get a
   dart stack trace under 'gdb' when in a native or runtime function.

R=regis@google.com

Review URL: https://codereview.chromium.org//23453035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27166 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 23:42:13 +00:00
srdjan@google.com 8cd4bf5b92 Change inlined stack frame iterator to use code and pc instead of frame.
R=asiva@google.com

Review URL: https://codereview.chromium.org//23494026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27140 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 19:36:20 +00:00
fschneider@google.com 98070a3bec Collect all Dart frames when creating a full stacktrace.
BUG=https://code.google.com/p/dart/issues/detail?id=11261
R=asiva@google.com

Review URL: https://codereview.chromium.org//22398002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25867 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-07 09:32:14 +00:00
regis@google.com 09bcdc6d6d Fix VM implementation of CastError not to extend TypeError (issue 5280).
Remove non-compliant fields in various Error classes (issue 10144).
Remove implicit constructor when patching in a constructor (issue 12217).
Patch corelib Error classes instead of declaring subclasses.
Update tests and status files.

R=asiva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//21832003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25782 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-05 18:35:04 +00:00
asiva@google.com 48418a75f7 Fix stack frame index numbers for full stack traces
It used to be:
#0      getCurrentStackTrace (file:///tmp/junk.dart:3:5)
#0      func1 (file:///tmp/junk.dart:10:29)
#1      func2 (file:///tmp/junk.dart:14:8)
#2      func3 (file:///tmp/junk.dart:18:8)
#3      func4 (file:///tmp/junk.dart:22:8)
#4      main (file:///tmp/junk.dart:26:8)
(Notice the two #0 frames on top).

Now it will print this as:
#0      getCurrentStackTrace (file:///tmp/junk.dart:3:5)
#1      func1 (file:///tmp/junk.dart:10:29)
#2      func2 (file:///tmp/junk.dart:14:8)
#3      func3 (file:///tmp/junk.dart:18:8)
#4      func4 (file:///tmp/junk.dart:22:8)
#5      main (file:///tmp/junk.dart:26:8)
Review URL: https://codereview.chromium.org//12381030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19272 260f80e4-7a28-3924-810f-c04153c831b5
2013-03-01 03:00:52 +00:00
asiva@google.com 3c90369ba6 Add functionality to get full stack trace when exceptions are thrown.
This should address the issue raised in 7813.

try {
 ...
 ...
} on Object catch(e, s) {
 print(s.fullStackTrace);  // This should print the full stack trace.
}
Review URL: https://codereview.chromium.org//12316116

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19179 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-27 22:47:06 +00:00