我在谷歌上搜索后,发现以下方法可以对Node.js应用程序进行GDB调试, 使用"./configure --debug"选项构建Node.js,然后执行
gdb --args ~/node_g start.js
我正在使用这个工具来调试一个小程序,但是在设置了断点之后,我无法看到它是否在那个函数中停止。
我的简单程序gdb_node.js如下:
function abc() {
console.log("In abc");
}
function bcd() {
abc();
console.log("Done abc");
}
bcd();
现在我正在使用gdb:
(gdb) b bcd
Function "bcd" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (bcd) pending.
(gdb) run
Starting program: /Users/mayukh/node_g gdb_node.js
Reading symbols for shared libraries
++++......................................................................................................................................... 完成
In abc
Done abc
Program exited normally.
(gdb)
有人能告诉我这里我错过了什么吗?
谢谢, -M-
node inspect
代替node debug
。 - morhook