使用node-inspector调试节点src / http.js [英] Debugging nodes src/http.js with node-inspector

查看:136
本文介绍了使用node-inspector调试节点src / http.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些坏运气调试一个node.js应用程序。问题是我需要在一个没有加载的文件中设置一个断点(当--debug-blk)命中的时候。文件是节点本身的http.js。



所以我想修改文件来添加调试器;语句,但我无法在我的磁盘上找到这个http.js文件?我在磁盘上看到的唯一的地方就是节点(lib / http.js)的源码分发。在node-src中的make install之后,该文件位于哪里,如何在其中设置断点?

解决方案

http.js是节点可执行文件的内部。它不存在于磁盘上,修改它的唯一方法是从源代码生成节点。



执行此操作:

  var http = require('http'); 
调试器;

//您的其他应用程序

您的应用程序将启动,加载http,然后暂停。现在您可以使用检查器在http中设置断点。 (您将不需要 - debug-brk ,因为调试器语句将在任何事情发生之前暂停该应用程序。 )


I'm having some bad luck debugging a node.js application. The problem is that I need to set a breakpoint in a file that isn't loaded at start (when --debug-blk) hits in. The file is http.js from node itself.

So I would like to modify the file to add a debugger; statement, but I'm unable to find this http.js file on my disk? The only place I see it on my disk is in the source distribution of node (lib/http.js). Where is this file located after a make install in node-src, and how can I set breakpoints inside it?

解决方案

http.js is internal to the node executable. It doesn't exist on disk, and the only way to modify it is to build node from source.

Do this:

var http = require('http');
debugger;

// the rest of your app

Your app will start, load http, and then pause. Now you can use the inspector to set breakpoints inside http. (You won't need --debug-brk since the debugger statement will pause the app before anything really happens.)

这篇关于使用node-inspector调试节点src / http.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆