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

inspector: introduce the --inspect-wait flag #52734

Merged
merged 3 commits into from
May 11, 2024

Conversation

cola119
Copy link
Member

@cola119 cola119 commented Apr 28, 2024

This PR introduces the --inspect-wait flag, which allows debugger to wait for attachement. This flag is useful when you want to debug the code from the beginning. Unlike --inspect-brk, which breaks on the first line, this flag waits for debugger to be connected and then runs the code as soon as a session is established.

It's designed to simplify debugging by removing the need for manual intervention and providing a smoother debugging experience. With support for breaking on the first line and automatic process resumption, it streamlines the debugging process.

Other runtime works include:

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Apr 28, 2024
@cola119 cola119 force-pushed the introduce-inspect-wait branch 2 times, most recently from 23e582e to 6422bd5 Compare April 28, 2024 14:01
@cola119 cola119 added the inspector Issues and PRs related to the V8 inspector protocol label Apr 28, 2024
@benjamingr
Copy link
Member

benjamingr commented Apr 28, 2024

I'm not sure I understand the use case? Shouldn't this be solved from the consumer side that can call Debugger.resume (or some such) after attaching with --inspect-brk?

@cola119
Copy link
Member Author

cola119 commented Apr 29, 2024

Shouldn't this be solved from the consumer side that can call Debugger.resume (or some such) after attaching with --inspect-brk?

Yes, the --inspect-wait flag acts like a combination of --inspect-brk and the client's Debugger.resume call. It's designed to simplify debugging by removing the need for manual intervention and providing a smoother debugging experience. With support for breaking on the first line and automatic process resumption, I believe it streamlines the debugging process.

@cola119
Copy link
Member Author

cola119 commented Apr 30, 2024

cc @nodejs/inspector

@daeyeon
Copy link
Member

daeyeon commented May 1, 2024

@cola119 cola119 added the request-ci Add this label to start a Jenkins CI on a PR. label May 1, 2024
@cola119
Copy link
Member Author

cola119 commented May 1, 2024

@daeyeon Done

@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels May 1, 2024

This comment was marked as resolved.

@daeyeon daeyeon added request-ci Add this label to start a Jenkins CI on a PR. semver-minor PRs that contain new features and should be released in the next minor version. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. semver-minor PRs that contain new features and should be released in the next minor version. labels May 3, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 3, 2024
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

-->

Activate inspector on `host:port` and wait for debugger to be attached.
Default `host:port` is `127.0.0.1:9229`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs should likely include additional detail explaining the difference between this and --inspect-brk. Just looking at this I would have no idea as an unfamiliar user which to choose and why.

Using the `--inspect` flag will execute the code immediately before debugger
is connected. This could be problematic if you intend to debug the code from the beginning.
In such cases, you can use the `--inspect-wait` flag instead, which waits for debugger to be attached,
or the `--inspect-brk` flag to break on the first line of the code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good but could be expanded a bit to explain more of the difference. Why would I use one verses the other?

targos pushed a commit that referenced this pull request May 12, 2024
PR-URL: #52734
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
@targos targos added the semver-minor PRs that contain new features and should be released in the next minor version. label May 13, 2024
@targos
Copy link
Member

targos commented May 13, 2024

This PR adds a feature so it should be labeled semver-minor PRs that contain new features and should be released in the next minor version. (this is not supposed to be done by releasers).

@cola119 cola119 deleted the introduce-inspect-wait branch May 13, 2024 13:21
@cola119
Copy link
Member Author

cola119 commented May 13, 2024

@targos Understood, I'll keep that in mind.

targos added a commit that referenced this pull request May 13, 2024
Notable changes:

cli:
  * (SEMVER-MINOR) allow running wasm in limited vmem with
    --disable-wasm-trap-handler (Joyee Cheung)
    #52766
doc:
  * add pimterry to collaborators (Tim Perry)
    #52874
fs:
  * (SEMVER-MINOR) allow 'withFileTypes' to be used with globs
    (Aviv Keller) #52837
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno)
    #52734
lib,src:
  * remove --experimental-policy (Rafael Gonzaga)
    #52583
perf_hooks:
  * (SEMVER-MINOR) add `deliveryType` and `responseStatus` fields
    (Matthew Aitken) #51589
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig)
    #52860
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung)
    #52692

PR-URL: #52971
targos added a commit that referenced this pull request May 15, 2024
Notable changes:

cli:
  * (SEMVER-MINOR) allow running wasm in limited vmem with
    --disable-wasm-trap-handler (Joyee Cheung)
    #52766
doc:
  * add pimterry to collaborators (Tim Perry)
    #52874
fs:
  * (SEMVER-MINOR) allow 'withFileTypes' to be used with globs
    (Aviv Keller) #52837
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno)
    #52734
lib,src:
  * remove --experimental-policy (Rafael Gonzaga)
    #52583
perf_hooks:
  * (SEMVER-MINOR) add `deliveryType` and `responseStatus` fields
    (Matthew Aitken) #51589
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig)
    #52860
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung)
    #52692

PR-URL: #52971
targos added a commit that referenced this pull request May 15, 2024
Notable changes:

cli:
  * (SEMVER-MINOR) allow running wasm in limited vmem with
    --disable-wasm-trap-handler (Joyee Cheung)
    #52766
doc:
  * add pimterry to collaborators (Tim Perry)
    #52874
fs:
  * (SEMVER-MINOR) allow 'withFileTypes' to be used with globs
    (Aviv Keller) #52837
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno)
    #52734
lib,src:
  * remove --experimental-policy (Rafael Gonzaga)
    #52583
perf_hooks:
  * (SEMVER-MINOR) add `deliveryType` and `responseStatus` fields
    (Matthew Aitken) #51589
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig)
    #52860
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung)
    #52692

PR-URL: #52971
marco-ippolito pushed a commit that referenced this pull request Jun 17, 2024
PR-URL: #52734
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
marco-ippolito added a commit that referenced this pull request Jun 17, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: TODO
marco-ippolito added a commit that referenced this pull request Jun 17, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
marco-ippolito added a commit that referenced this pull request Jun 17, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
marco-ippolito pushed a commit that referenced this pull request Jun 17, 2024
PR-URL: #52734
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
marco-ippolito added a commit that referenced this pull request Jun 17, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
marco-ippolito pushed a commit that referenced this pull request Jun 17, 2024
PR-URL: #52734
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
marco-ippolito added a commit that referenced this pull request Jun 17, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
marco-ippolito added a commit that referenced this pull request Jun 17, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
marco-ippolito added a commit that referenced this pull request Jun 19, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
marco-ippolito added a commit that referenced this pull request Jun 20, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
marco-ippolito added a commit that referenced this pull request Jun 20, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) #52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) #52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) #52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) #52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) #52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) #52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) #52692

PR-URL: #53486
EliphazBouye pushed a commit to EliphazBouye/node that referenced this pull request Jun 20, 2024
PR-URL: nodejs#52734
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
EliphazBouye pushed a commit to EliphazBouye/node that referenced this pull request Jun 20, 2024
Notable changes:

cli:
  * (SEMVER-MINOR) allow running wasm in limited vmem with
    --disable-wasm-trap-handler (Joyee Cheung)
    nodejs#52766
doc:
  * add pimterry to collaborators (Tim Perry)
    nodejs#52874
fs:
  * (SEMVER-MINOR) allow 'withFileTypes' to be used with globs
    (Aviv Keller) nodejs#52837
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno)
    nodejs#52734
lib,src:
  * remove --experimental-policy (Rafael Gonzaga)
    nodejs#52583
perf_hooks:
  * (SEMVER-MINOR) add `deliveryType` and `responseStatus` fields
    (Matthew Aitken) nodejs#51589
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig)
    nodejs#52860
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung)
    nodejs#52692

PR-URL: nodejs#52971
EliphazBouye pushed a commit to EliphazBouye/node that referenced this pull request Jun 20, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) nodejs#52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) nodejs#52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) nodejs#52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) nodejs#52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) nodejs#52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) nodejs#52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) nodejs#52692

PR-URL: nodejs#53486
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
PR-URL: nodejs#52734
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
Notable changes:

cli:
  * (SEMVER-MINOR) allow running wasm in limited vmem with
    --disable-wasm-trap-handler (Joyee Cheung)
    nodejs#52766
doc:
  * add pimterry to collaborators (Tim Perry)
    nodejs#52874
fs:
  * (SEMVER-MINOR) allow 'withFileTypes' to be used with globs
    (Aviv Keller) nodejs#52837
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno)
    nodejs#52734
lib,src:
  * remove --experimental-policy (Rafael Gonzaga)
    nodejs#52583
perf_hooks:
  * (SEMVER-MINOR) add `deliveryType` and `responseStatus` fields
    (Matthew Aitken) nodejs#51589
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig)
    nodejs#52860
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung)
    nodejs#52692

PR-URL: nodejs#52971
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
Notable changes:

doc:
  * add pimterry to collaborators (Tim Perry) nodejs#52874
inspector:
  * (SEMVER-MINOR) introduce the `--inspect-wait` flag (Kohei Ueno) nodejs#52734
test_runner:
  * (SEMVER-MINOR) support test plans (Colin Ihrig) nodejs#52860
tools:
  * (SEMVER-MINOR) fix get_asan_state() in tools/test.py (Joyee Cheung) nodejs#52766
  * (SEMVER-MINOR) support max_virtual_memory test configuration (Joyee Cheung) nodejs#52766
  * (SEMVER-MINOR) support != in test status files (Joyee Cheung) nodejs#52766
zlib:
  * (SEMVER-MINOR) expose zlib.crc32() (Joyee Cheung) nodejs#52692

PR-URL: nodejs#53486
@june07
Copy link

june07 commented Aug 11, 2024

I'm not sure I understand the use case? Shouldn't this be solved from the consumer side that can call Debugger.resume (or some such) after attaching with --inspect-brk?

NiM has had this feature since circa 2020
#30911 (comment) so I find this amusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. inspector Issues and PRs related to the V8 inspector protocol lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants