From c4a7b7277a4127fbddedf78049b2af33b995d5a2 Mon Sep 17 00:00:00 2001 From: Troels Liebe Bentsen Date: Fri, 24 Aug 2018 20:52:18 +0200 Subject: [PATCH 1/5] Add section on how to build debug build --- BUILDING.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index 73e685784559aa..a494ce291f0007 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -253,6 +253,23 @@ To install this version of Node.js into a system directory: $ [sudo] make install ``` +#### Building a debug build + +If you run into a issue where Node.js segfaults and the "segfault-handler" does not provide enough information, you might have to build a debug build of Node.js to get enough information to debug the issue further, this is done by : + +```console +$ ./configure --debug +$ make -j4 +``` + +A make with "./configure --debug" generates two binaries, the regular release one in "out/Release/node" and a debug build in "out/Debug/node", only the release version is actually installed when you run "make install". + +To use the debug build with 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 +``` ### Windows From b81cd6a0481d9e6e7a84f821ab5aac214d206635 Mon Sep 17 00:00:00 2001 From: Mathias <2278040+mathiastj@users.noreply.github.com> Date: Wed, 29 Aug 2018 14:33:22 +0200 Subject: [PATCH 2/5] doc: clarify building a debug build --- BUILDING.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index a494ce291f0007..ba09d3c9ea4969 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -255,22 +255,31 @@ $ [sudo] make install #### Building a debug build -If you run into a issue where Node.js segfaults and the "segfault-handler" does not provide enough information, you might have to build a debug build of Node.js to get enough information to debug the issue further, this is done by : +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 ``` -A make with "./configure --debug" generates two binaries, the regular release one in "out/Release/node" and a debug build in "out/Debug/node", only the release version is actually installed when you run "make install". +`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 with all the normal dependencies overwrite the release version in the install directory: +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. + ### Windows Prerequisites: From d5c02d597c381b870ca57c89cf60716a870a4fac Mon Sep 17 00:00:00 2001 From: Troels Liebe Bentsen Date: Wed, 29 Aug 2018 23:10:40 +0200 Subject: [PATCH 3/5] Added a bit of detail on gdb and backtrace --- BUILDING.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/BUILDING.md b/BUILDING.md index ba09d3c9ea4969..015c6c642895d0 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -280,6 +280,17 @@ 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 +core dump was captured, so 64bit gdb if node was build as 64bit and Linux gdb if node +was built on Linux else you might 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 Prerequisites: From 91fe56d76c192d4385f3a80f529f7eefeb07268e Mon Sep 17 00:00:00 2001 From: Troels Liebe Bentsen Date: Thu, 30 Aug 2018 00:02:22 +0200 Subject: [PATCH 4/5] Minor tweaks from @lundibundi --- BUILDING.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 015c6c642895d0..e265469b722b5e 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -266,10 +266,10 @@ $ 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`. +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: +version in the install directory: ``` console $ make install --prefix=/opt/node-debug/ @@ -280,9 +280,10 @@ 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 -core dump was captured, so 64bit gdb if node was build as 64bit and Linux gdb if node -was built on Linux else you might get errors like "not in executable format: File format not recognized". +Reading the core dump requires gdb built on the same platform core dump was +captured on(i.e. 64bit gdb for node built on a 64bit system, Linux gdb +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: From aa7d6ad37aa21e2f88298dece5b41c8ef657f9bd Mon Sep 17 00:00:00 2001 From: Mathias <2278040+mathiastj@users.noreply.github.com> Date: Thu, 30 Aug 2018 09:52:42 +0200 Subject: [PATCH 5/5] minor tweaks from @vsemozhetbyt --- BUILDING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index e265469b722b5e..30079ca61c4f42 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -280,16 +280,16 @@ 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 -captured on(i.e. 64bit gdb for node built on a 64bit system, Linux gdb -for node built on Linux) otherwise you will get errors like -"not in executable format: File format not recognized". +Reading the core dump requires `gdb` built on the same platform the core dump +was captured on (i.e. 64 bit `gdb` for `node` built on a 64 bit system, Linux +`gdb` 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 +$ gdb /opt/node-debug/node core.node.8.1535359906 +$ backtrace ``` ### Windows