From 3532f5587c9ed3610fb52d885d6ebb9864e420a8 Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Thu, 18 Jan 2024 14:30:33 +0800 Subject: [PATCH] doc: add notes on inspector breakpoints Setting breakpoints with a same-thread inspector session should be avoided because the program being attached and paused is exactly the debugger itself. A worker thread inspector session or a debugger program should be used if breakpoints are needed. PR-URL: https://github.com/nodejs/node/pull/51417 Fixes: https://github.com/nodejs/node/issues/51397 Reviewed-By: Luigi Pinca --- doc/api/inspector.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/api/inspector.md b/doc/api/inspector.md index 7d91377fc0040e..05178153ceb630 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -74,6 +74,9 @@ session.on('inspectorNotification', (message) => console.log(message.method)); // Debugger.resumed ``` +> **Caveat** Breakpoints with same-thread session is not recommended, see +> [support of breakpoints][]. + It is also possible to subscribe only to notifications with specific method: #### Event: ``; @@ -98,6 +101,9 @@ session.on('Debugger.paused', ({ params }) => { // [ '/the/file/that/has/the/breakpoint.js:11:0' ] ``` +> **Caveat** Breakpoints with same-thread session is not recommended, see +> [support of breakpoints][]. + #### `session.connect()`