Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI support for TimeTravel Debugging #7734

Merged
merged 3 commits into from
Jun 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/vs/workbench/parts/debug/browser/debugActionsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution {
private actions: actions.IAction[];
private pauseAction: dbgactions.PauseAction;
private continueAction: dbgactions.ContinueAction;
private stepBackAction: dbgactions.StepBackDebugAction;
private isVisible: boolean;
private isBuilt: boolean;

Expand Down Expand Up @@ -120,10 +121,22 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution {
this.toDispose.push(a);
});
this.toDispose.push(this.pauseAction);
this.toDispose.push(this.continueAction);
}
this.actions[0] = state === debug.State.Running ? this.pauseAction : this.continueAction;

return this.actions;
const activeSession = this.debugService.getActiveSession();
if (activeSession && activeSession.configuration.capabilities.supportsStepBack) {
if (!this.stepBackAction) {
this.stepBackAction = instantiationService.createInstance(dbgactions.StepBackDebugAction, dbgactions.StepBackDebugAction.ID, dbgactions.StepBackDebugAction.LABEL);
this.toDispose.push(this.stepBackAction);
}

// Return a copy of this.actions containing stepBackAction
return [...this.actions.slice(0, 4), this.stepBackAction, ...this.actions.slice(4)];
} else {
return this.actions;
}
}

public dispose(): void {
Expand Down
15 changes: 15 additions & 0 deletions src/vs/workbench/parts/debug/browser/media/debug.contribution.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
background: url('step-out.svg') center center no-repeat;
}

.monaco-workbench .debug-action.step-back {
background: url('step-over.svg') center center no-repeat;
transform: scaleX(-1);
}

.monaco-workbench .debug-action.continue {
background: url('continue.svg') center center no-repeat;
}
Expand Down Expand Up @@ -280,6 +285,11 @@
background: url('step-out-inverse.svg') center center no-repeat;
}

.vs-dark .monaco-workbench .debug-action.step-back {
background: url('step-over-inverse.svg') center center no-repeat;
transform: scaleX(-1);
}

.vs-dark .monaco-workbench .debug-action.continue {
background: url('continue-inverse.svg') center center no-repeat;
}
Expand Down Expand Up @@ -340,6 +350,11 @@
background: url('step-out-inverse.svg') center center no-repeat;
}

.hc-black .monaco-workbench .debug-action.step-back {
background: url('step-over-inverse.svg') center center no-repeat;
transform: scaleX(-1);
}

.hc-black .monaco-workbench .debug-action.continue {
background: url('continue-inverse.svg') center center no-repeat;
}
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/parts/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ export interface IDebugService {
next(threadId: number): TPromise<void>;
stepIn(threadId: number): TPromise<void>;
stepOut(threadId: number): TPromise<void>;
stepBack(threadId: number): TPromise<void>;
continue(threadId: number): TPromise<void>;
pause(threadId: number): TPromise<any>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepOverDebugAction, dbgactions.StepOverDebugAction.ID, dbgactions.StepOverDebugAction.LABEL, { primary: KeyCode.F10 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), 'Debug: Step Over', debugCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepIntoDebugAction, dbgactions.StepIntoDebugAction.ID, dbgactions.StepIntoDebugAction.LABEL, { primary: KeyCode.F11 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE), KeybindingsRegistry.WEIGHT.workbenchContrib(1)), 'Debug: Step Into', debugCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepOutDebugAction, dbgactions.StepOutDebugAction.ID, dbgactions.StepOutDebugAction.LABEL, { primary: KeyMod.Shift | KeyCode.F11 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), 'Debug: Step Out', debugCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StepBackDebugAction, dbgactions.StepBackDebugAction.ID, dbgactions.StepBackDebugAction.LABEL, { primary: KeyMod.Shift | KeyCode.F10 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), 'Debug: Step Back', debugCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.RestartDebugAction, dbgactions.RestartDebugAction.ID, dbgactions.RestartDebugAction.LABEL, { primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.F5 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), 'Debug: Restart', debugCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.StopDebugAction, dbgactions.StopDebugAction.ID, dbgactions.StopDebugAction.LABEL, { primary: KeyMod.Shift | KeyCode.F5 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), 'Debug: Stop', debugCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(dbgactions.ContinueAction, dbgactions.ContinueAction.ID, dbgactions.ContinueAction.LABEL, { primary: KeyCode.F5 }, KbExpr.has(debug.CONTEXT_IN_DEBUG_MODE)), 'Debug: Continue', debugCategory);
Expand Down
22 changes: 22 additions & 0 deletions src/vs/workbench/parts/debug/electron-browser/debugActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,28 @@ export class StepOutDebugAction extends AbstractDebugAction {
}
}

export class StepBackDebugAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.stepBack';
static LABEL = nls.localize('stepBackDebug', "Step Back");

constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, 'debug-action step-back', debugService, keybindingService);
}

public run(thread: debug.IThread): TPromise<any> {
const threadId = thread && thread instanceof model.Thread ? thread.threadId
: this.debugService.getViewModel().getFocusedThreadId();

return this.debugService.stepBack(threadId);
}

protected isEnabled(state: debug.State): boolean {
const activeSession = this.debugService.getActiveSession();
return super.isEnabled(state) && state === debug.State.Stopped &&
activeSession && activeSession.configuration.capabilities.supportsStepBack;
}
}

export class StopDebugAction extends AbstractDebugAction {
static ID = 'workbench.action.debug.stop';
static LABEL = nls.localize('stopDebug', "Stop");
Expand Down
10 changes: 10 additions & 0 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,16 @@ export class DebugService implements debug.IDebugService {
});
}

public stepBack(threadId: number): TPromise<void> {
if (!this.session) {
return TPromise.as(null);
}

return this.session.stepBack({ threadId }).then(() => {
this.lazyTransitionToRunningState(threadId);
});
}

public continue(threadId: number): TPromise<void> {
if (!this.session) {
return TPromise.as(null);
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/parts/debug/node/rawDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.IRawDebugSes
return this.send('stepOut', args);
}

public stepBack(args: DebugProtocol.StepBackArguments): TPromise<DebugProtocol.StepBackResponse> {
return this.send('stepBack', args);
}

public continue(args: DebugProtocol.ContinueArguments): TPromise<DebugProtocol.ContinueResponse> {
return this.send('continue', args);
}
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/parts/debug/test/common/mockDebugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export class MockDebugService implements debug.IDebugService {
return TPromise.as(null);
}

public stepBack(threadId: number): TPromise<void> {
return TPromise.as(null);
}

public continue(threadId: number): TPromise<void> {
return TPromise.as(null);
}
Expand Down