Can node-inspector debug an app without pausing it?

被刻印的时光 ゝ 提交于 2019-12-23 04:31:45

问题


Node-inspector is a fantastic tool for debugging server-side code just as one would use the Chrome developer tools. I'm using it to debug a Meteor server, as in https://stackoverflow.com/a/19438774/586086.

One thing that would be even better would be to be able to use the debugging console to inspect objects while the app is running, without pausing it, as allowed by the Chrome developer tools. Currently, if one tries to do this without pausing, the following type of error is displayed:

It seems that there should be a way to replicate the client-side debugging functionality that Chrome has, by inserting the inspection code into the Node event loop, instead of pausing to do it. Does anyone know if this is possible?


回答1:


Disclaimer: I am the maintainer of Node Inspector.

The V8 debugger protocol used by Node Inspector does not support inspecting objects while the program is running. (Well, it allows you to inspect an object, but you can't inspect the result of the inspection.) Chrome Developer Tools apply a workaround, they are injecting their custom javascript code into the web page and using this injected code to perform inspections.

It should be possible to inject the same code from Node Inspector and rewrite Node Inspector inspections to call the injected code instead of using the V8 debugger protocol. The change is probably not too difficult, but it still requires a decent amount of time.

If you like to contribute this feature, I am happy to help you. Please open a github issue to discuss implementation details.



来源:https://stackoverflow.com/questions/22360652/can-node-inspector-debug-an-app-without-pausing-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!