Utilities for debugging Node.js C++ Addons
$ npm install cpp-debugAdd an include_dirs section to your project's binding.gyp file so that it resembles the following:
{
"targets": [
{
"target_name": "addon",
"sources": [ "binding.cc" ],
"include_dirs": [
"<!(node -e \"require('cpp-debug')\")"
]
}
]
}Then include cpp-debug.h in your addon:
#include"cpp-debug.h"cpp-debug provides the following functions for use anywhere in your native addon code:
std::string hexDump(constunsignedchar* data, unsignedint len)voidprintHexDump(constunsignedchar* data, unsignedint len)