问题描述
我正在编写一个Node.Js C ++插件,当我尝试通过在互联网上搜索的方式调试我的c ++插件时,它根本无法工作.
I am writing a Node.Js C++ addon,When I try to debug my c++ add by the way i searched on internet,it just cannt work at all.
我从互联网上得到的是gdb节点设置参数app.js运行
what i get from internet isgdb nodeset args app.jsrun
我明白了/usr/local/bin/node:不能采用可执行格式:无法识别文件格式
i get this/usr/local/bin/node": not in executable format: File format not recognized
在键入文件/usr/local/bin/node
after type file /usr/local/bin/node
我明白了/usr/local/bin/node:具有2种架构的Mach-O通用二进制文件/usr/local/bin/node(对于体系结构i386):Mach-O可执行文件i386/usr/local/bin/node(对于体系结构x86_64):Mach-O 64位可执行文件x86_64
i get this/usr/local/bin/node: Mach-O universal binary with 2 architectures/usr/local/bin/node (for architecture i386): Mach-O executable i386/usr/local/bin/node (for architecture x86_64): Mach-O 64-bit executable x86_64
我不知道为什么我的gdb告诉我该节点不是可执行的格式
i dont konw why my gdb told me the node is not a executeable fomat
推荐答案
您是否在启用调试的情况下构建了node.js?看来您使用的是Mac,如果您使用自制软件安装模式,请尝试以下操作:
Did you build node.js with debugging enabled? It looks like you are on a mac, if you used homebrew to install mode, try the following:
brew install nodejs --with-debug
然后尝试:
gdb --args /usr/local/bin/node app.js
Mac上的gdb也已不赞成使用lldb,因此您也可以尝试lldb:
Also gdb on the mac has been deprecated in favor of lldb so you might try lldb as well:
lldb -- /usr/local/bin/node app.js
这篇关于如何通过gdb调试Node.js插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!