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

Unified Diff: runtime/observatory/lib/src/elements/debugger.dart

Issue 2785553005: Display the awaiter call stack in Observatory (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/elements/debugger.dart
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index 9b1cc616dcdc8b3aae625a892dad196cefd41f3a..c4b445677608b4e019297ef41978152468a9c562 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -600,9 +600,14 @@ class SetCommand extends DebuggerCommand {
],
'causal-async-stacks': [
_boolValues,
- _setSaneAsyncStacks,
+ _setCausalAsyncStacks,
(debugger, _) => debugger.saneAsyncStacks
],
+ 'awaiter-stacks': [
+ _boolValues,
+ _setAwaiterStacks,
+ (debugger, _) => debugger.awaiterStacks
+ ]
};
static Future _setBreakOnException(debugger, name, value) async {
@@ -624,16 +629,22 @@ class SetCommand extends DebuggerCommand {
debugger.console.print('${name} = ${value}');
}
- static Future _setSaneAsyncStacks(debugger, name, value) async {
+ static Future _setCausalAsyncStacks(debugger, name, value) async {
if (value == 'true') {
- debugger.saneAsyncStacks = true;
+ debugger.causalAsyncStacks = true;
} else {
- debugger.saneAsyncStacks = false;
+ debugger.causalAsyncStacks = false;
}
debugger.refreshStack();
debugger.console.print('${name} = ${value}');
}
+ static Future _setAwaiterStacks(debugger, name, value) async {
+ debugger.awaiterStacks = (value == 'true');
+ debugger.refreshStack();
+ debugger.console.print('${name} == ${value}');
+ }
+
Future run(List<String> args) async {
if (args.length == 0) {
for (var name in _options.keys) {
@@ -1363,14 +1374,23 @@ class ObservatoryDebugger extends Debugger {
bool _upIsDown;
- bool get saneAsyncStacks => _saneAsyncStacks;
- void set saneAsyncStacks(bool value) {
+ bool get causalAsyncStacks => _causalAsyncStacks;
+ void set causalAsyncStacks(bool value) {
settings.set('causal-async-stacks', value);
- _saneAsyncStacks = value;
+ _causalAsyncStacks = value;
+ }
+
+ bool _causalAsyncStacks;
+
+ bool get awaiterStacks => _awaiterStacks;
+ void set awaiterStacks(bool value) {
+ settings.set('awaiter-stacks', value);
+ _causalAsyncStacks = value;
}
- bool _saneAsyncStacks;
+ bool _awaiterStacks;
+ static const String kAwaiterStackFrames = 'awaiterFrames';
static const String kAsyncCausalStackFrames = 'asyncCausalFrames';
static const String kStackFrames = 'frames';
@@ -1391,31 +1411,35 @@ class ObservatoryDebugger extends Debugger {
}
int get stackDepth {
- if (saneAsyncStacks) {
+ if (awaiterStacks) {
+ var awaiterStackFrames = stack[kAwaiterStackFrames];
+ if (awaiterStackFrames != null) {
+ return awaiterStackFrames.length;
+ }
+ }
+ if (causalAsyncStacks) {
var asyncCausalStackFrames = stack[kAsyncCausalStackFrames];
- var stackFrames = stack[kStackFrames];
- if (asyncCausalStackFrames == null) {
- // No causal frames.
- return stackFrames.length;
+ if (asyncCausalStackFrames != null) {
+ return asyncCausalStackFrames.length;
}
- return asyncCausalStackFrames.length;
- } else {
- return stack[kStackFrames].length;
}
+ return stack[kStackFrames].length;
}
List get stackFrames {
- if (saneAsyncStacks) {
+ if (awaiterStacks) {
+ var awaiterStackFrames = stack[kAwaiterStackFrames];
+ if (awaiterStackFrames != null) {
+ return awaiterStackFrames;
+ }
+ }
+ if (causalAsyncStacks) {
var asyncCausalStackFrames = stack[kAsyncCausalStackFrames];
- var stackFrames = stack[kStackFrames];
- if (asyncCausalStackFrames == null) {
- // No causal frames.
- return stackFrames ?? [];
+ if (asyncCausalStackFrames != null) {
+ return asyncCausalStackFrames;
}
- return asyncCausalStackFrames;
- } else {
- return stack[kStackFrames] ?? [];
}
+ return stack[kStackFrames] ?? [];
}
static final _history = [''];
@@ -1453,7 +1477,8 @@ class ObservatoryDebugger extends Debugger {
void _loadSettings() {
_upIsDown = settings.get('up-is-down');
- _saneAsyncStacks = settings.get('causal-async-stacks') ?? true;
+ _causalAsyncStacks = settings.get('causal-async-stacks') ?? true;
+ _awaiterStacks = settings.get('awaiter-stacks') ?? true;
}
S.VM get vm => page.app.vm;
@@ -2272,7 +2297,10 @@ class DebuggerStackElement extends HtmlElement implements Renderable {
void updateStackFrames(S.ServiceMap newStack) {
List frameElements = _frameList.children;
List newFrames;
- if (_debugger.saneAsyncStacks &&
+ if (_debugger.awaiterStacks &&
+ (newStack[ObservatoryDebugger.kAwaiterStackFrames] != null)) {
+ newFrames = newStack[ObservatoryDebugger.kAwaiterStackFrames];
+ } else if (_debugger.causalAsyncStacks &&
(newStack[ObservatoryDebugger.kAsyncCausalStackFrames] != null)) {
newFrames = newStack[ObservatoryDebugger.kAsyncCausalStackFrames];
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698