-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Add section on how to build debug build #22510
Changes from 4 commits
c4a7b72
b81cd6a
5e3717b
d5c02d5
91fe56d
aa7d6ad
2f3d272
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,6 +253,43 @@ To install this version of Node.js into a system directory: | |
$ [sudo] make install | ||
``` | ||
|
||
#### Building a debug build | ||
|
||
If you run into an issue where the information provided by the JS stack trace | ||
is not enough, or if you suspect the error happens outside of the JS VM, you | ||
can try to build a debug enabled binary: | ||
|
||
```console | ||
$ ./configure --debug | ||
$ make -j4 | ||
``` | ||
|
||
`make` with `./configure --debug` generates two binaries, the regular release | ||
one in `out/Release/node` and a debug binary in `out/Debug/node`, only the | ||
release version is actually installed when you run `make install`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: unnecessary space at the beginning. |
||
|
||
To use the debug build with all the normal dependencies overwrite the release | ||
version in the install directory: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also space. |
||
|
||
``` console | ||
$ make install --prefix=/opt/node-debug/ | ||
$ cp -a -f out/Debug/node /opt/node-debug/node | ||
``` | ||
|
||
When using the debug binary, core dumps will be generated in case of crashes. | ||
These core dumps are useful for debugging when provided with the | ||
corresponding original debug binary and system information. | ||
|
||
Reading the core dump requires a gdb that was build on the same platform as the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest: |
||
core dump was captured, so 64bit gdb if node was build as 64bit and Linux gdb if node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
was built on Linux else you might get errors like "not in executable format: File format not recognized". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/else/otherwise/ Also, shouldn't |
||
|
||
Example of generating a backtrace from the core dump: | ||
|
||
``` console | ||
gdb /opt/node-debug/node core.node.8.1535359906 | ||
backtrace | ||
``` | ||
|
||
### Windows | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might suggest
make -C out BUILDTYPE=Debug -j4
to avoid unnececerily building theRelease
binary. That could allow you to replace the following paragraph with: