I have a node.js module written in C++ that provides some bindings for a C++ library. The library crashes with SIGSEGV, so I need to debug it with GDB and find out what goes wrong.
I already have the source for the module in ./node_modules/somelib/
and if I go to that folder and type npm install
the library is compiled and can be used through a require('somelib') from node.js. I can attach gdb to node and reproduce the error, but in the stacktrace I just see node_modules/somelib/Release/somelib.node
.
I'm not sure if this is important but the library is compiled using node-gyp
.
node-gyp
to produce debug symbols?I just found the answer to this in the node-gyp
documentation. The solution is to invoke the build process with the --debug
flag. That means to invoke node-gyp configure --debug
and/or node-gyp build --debug
. Then instead of a Release
folder a Debug
folder will be created. gdb will then automatically load the source files.