Dave, I was trying to figure this out too. Just cracked it -- see my blog post <http://people.cs.vt.edu/~davisjam/blog-technical.html#node-debugging-cpp-addons> for details. The short version is: recompile the add-on using node-gyp --debug, possibly change the module load path to use the Debug version, and then set break points as normal.
On Thursday, January 14, 2016 at 12:00:42 PM UTC-5, Alexander List wrote: > > Dave, > > How did you use gdb to set breakpoints in your C++ add-in code, that got > triggered after calling `node test.js`? > > Thanks! > > On Wednesday, June 27, 2012 at 1:19:26 AM UTC-4, Dave Horton wrote: >> >> Any suggestions along these lines welcome. I'm writing my first C++ >> add-in and struggling with a couple of things: >> >> 1) I can use gdb to set breakpoints in my code, but node-gyp by default >> doesn't include symbols and I haven't been able to figure out how to get it >> to generate debug code (non optimized, no symbols). I tried "defines": >> ['DEBUG'] but that didn't work.... >> >> 2) I tried putting simple printf's in my code to stdout or stderr but >> they don't appear so I assume they are being gobbled up by node some how. >> >> For a first exercise, I am simply trying to create a module that returns >> a wrapped C++ object, with a property which when accessed in JS triggers a >> C++ getter. I can compile the module ok, and my test script can create an >> instance, but it appears my getter is never called for some reason (it >> should return an integer value of 5060 but it returns undefined). For >> anyone willing to point out what I assume is an obvious flaw, I have posted >> a gist here: git://gist.github.com/3001626.git >> >> I've read the docs on nodejs.org on the basics of creating modules, but >> if anyone knows of useful sample code for a newbie to node (knowledgeable >> of javascript and C++) I'd appreciate the pointer. Thanks >> > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/87a9200c-15af-4a9e-aff7-27709f84d6e5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
