|
@@ -116,7 +116,7 @@ export class DebugSession implements IDebugger.ISession {
|
|
|
|
|
|
await this.sendRequest('attach', {});
|
|
await this.sendRequest('attach', {});
|
|
} catch (err) {
|
|
} catch (err) {
|
|
- console.error('Error: ', err.message);
|
|
|
|
|
|
+ console.error('Error:', err.message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -131,7 +131,7 @@ export class DebugSession implements IDebugger.ISession {
|
|
});
|
|
});
|
|
this._isStarted = false;
|
|
this._isStarted = false;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
- console.error('Error: ', err.message);
|
|
|
|
|
|
+ console.error('Error:', err.message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -139,6 +139,7 @@ export class DebugSession implements IDebugger.ISession {
|
|
* Restore the state of a debug session.
|
|
* Restore the state of a debug session.
|
|
*/
|
|
*/
|
|
async restoreState(): Promise<void> {
|
|
async restoreState(): Promise<void> {
|
|
|
|
+ await this.client.ready;
|
|
try {
|
|
try {
|
|
const message = await this.sendRequest('debugInfo', {});
|
|
const message = await this.sendRequest('debugInfo', {});
|
|
this._isStarted = message.body.isStarted;
|
|
this._isStarted = message.body.isStarted;
|
|
@@ -194,8 +195,13 @@ export class DebugSession implements IDebugger.ISession {
|
|
private async _sendDebugMessage(
|
|
private async _sendDebugMessage(
|
|
msg: KernelMessage.IDebugRequestMsg['content']
|
|
msg: KernelMessage.IDebugRequestMsg['content']
|
|
): Promise<KernelMessage.IDebugReplyMsg> {
|
|
): Promise<KernelMessage.IDebugReplyMsg> {
|
|
- const reply = new PromiseDelegate<KernelMessage.IDebugReplyMsg>();
|
|
|
|
const kernel = this.client.kernel;
|
|
const kernel = this.client.kernel;
|
|
|
|
+ if (!kernel) {
|
|
|
|
+ return Promise.reject(
|
|
|
|
+ new Error('A kernel is required to send debug messages.')
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ const reply = new PromiseDelegate<KernelMessage.IDebugReplyMsg>();
|
|
const future = kernel.requestDebug(msg);
|
|
const future = kernel.requestDebug(msg);
|
|
future.onReply = (msg: KernelMessage.IDebugReplyMsg) => {
|
|
future.onReply = (msg: KernelMessage.IDebugReplyMsg) => {
|
|
return reply.resolve(msg);
|
|
return reply.resolve(msg);
|