Since the advent of nodejs, we have noticed that the open-source ecosystem is growing around nodejs extends, plug-ins, and tools (tools/utilis, see the boom. This aspect is good, but it is not about the extensions or plug-ins here, but the debugging tool itself. Because there is no debugging tool, it is impossible to develop a little bit, or it is difficult. Everyone knows that debuggers are indispensable. Nodejs.org is also unambiguous about the debugger. Originally, the official early in the morning in nodejs built-in eclipse-based
Debugger plugin for V8 debugger interface, which provides a solution for debugging; in addition, I wrote a tutorial on debugging, which was extracted from the tutorial by the author Ryan Dahl.
It is said that eclipse is a big platform, open-source, and any ideas can be freely used on the eclipse platform! Let's take a look at the interface of the debugger. This is probably the case,
Figure 1
Figure is a classic eclipse-style interface ~ However, eclipse and nodejs debugging are not integrated. Why? Nodejs is the high-level extension of Google V8. It must be processed by V8 during debugging. Google V8 is an authentic JavaScript interpretation engine that does not contain debugging modules. That is to say, it requires the participation of other debugging modules. Therefore, V8/nodejs exposes relevant debugging interfaces and integrates these interfaces into specialized debugging modules, such as Eclipse debug view, to present a professional debugging environment.
The debugger introduced in this article is Google Chrome developer tools, which is positioned in the tool kit for chrome developers. At this moment, we use this tool to debug nodejs. Google Chrome developer tools is an Eclipse plug-in based on TCP remote debugging environment. The author Ryan Dahl considers that the debugger is directly added in the final environment of V8 C ++/eclipse Java, rather than remote debugging.-But why not? Why? The author's statement is to avoid plug-ins in C ++/Java
The instability caused by the two operations.
Well, let's go from the basics to the introduction of debugging nodejs. First, install Google Chrome Developer Tools. Assume that you are familiar with the basic usage of eclipse (you can skip this step if you are familiar with how to install the Eclipse plug-in ......), Choose Help> Software Updates... from the menu, as shown in.
After the dialog box appears, switch to the "available software" tab, as shown in.
Click Add site... on the right ......] Button. Is there a dialog box for entering the URL? This is Google Chrome developer tools. We paste it:
Http://chromedevtools.googlecode.com/svn/update/dev/
Then confirm OK, wait a moment, if the tree menu of the http://chromedevtools.googlecode.com/svn/update/dev/ appears, tick it to select download. Click "Install..." on the right ......].
Wait a moment to calculate the dependency ......
In the review licenses form, confirm the license and click Next to start installation:
After the installation progress is 100%, restart Eclipse IDE to make the plug-in take effect. Choose Windows> show View> debug to switch to the debugging view of Eclipse, as shown in figure 1 (nodejs is not linked yet. In this step, the debugging plug-in is installed, followed by the configuration of the debugger.
For example, in the red area, click the inverted triangle next to the debug icon, and click debug configurations in the drop-down menu ...]. Click standalone V8 VM from the options on the left, right-click it, and choose new to create a new debugging profile.
For example, enter the name [name] and port [port ]. You can set ports to node-5858, node-5859, and node-5860 ...... But must be consistent with the port specified in the nodejs script.
Click the debug button to go To the debugging page (1 ). Now, the plug-in installation, debugging, and port setting are complete. I plan to learn how to use JavaScriptSource code? Such as hitting, stepping, monitoring, and other basic debugging operations ...... In the next article, we will introduce you!