Skip to content
Closed
Changes from 5 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
38 changes: 38 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,44 @@ 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
Copy link
Copy Markdown
Contributor

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 the Release binary. That could allow you to replace the following paragraph with:

If the build finished successfully, the debug enabled binary will be at `out/Debug/node`

```

`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`.

To use the debug build with all the normal dependencies overwrite the release
version in the install directory:

``` 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 gdb built on the same platform core dump was
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

gdb -> `gdb` here and below?

captured on(i.e. 64bit gdb for node built on a 64bit system, Linux gdb
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

on(i.e. -> on (i.e. (missing space)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

node -> Node.js here and below (or node -> `node`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure but maybe 64bit -> 64 bit for consistency with other cases in this doc.

for node built on Linux) otherwise you will get errors like
"not in executable format: File format not recognized".

Example of generating a backtrace from the core dump:

``` console
gdb /opt/node-debug/node core.node.8.1535359906
backtrace
```

### Windows

Expand Down