(iv), node. js for program debugging

Source: Internet
Author: User
Tags chrome developer chrome developer tools

node. JS supports single-step debugging under the command line. The following is a simple program:

var a = 1;var B = ' world '; var c = function (x) {console.log (' hello ' + x + a);}; C (b);

Executing node debug debug.js at the command line will start the debugging tool:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/59/A9/wKioL1TbEvKT-l4_AABy-WpWoXk843.jpg "title=" Image.png "alt=" Wkiol1tbevkt-l4_aaby-wpwoxk843.jpg "/>

node. JS Debug command

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/A9/wKioL1TbEwbAMoZ8AAMluxiknd0919.jpg "title=" Image1.png "alt=" Wkiol1tbewbamoz8aamluxiknd0919.jpg "/>

Enter N to indicate the next line

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/AD/wKiom1TbEirSeY19AACbCOWCNfw417.jpg "title=" Image2.png "alt=" Wkiom1tbeirsey19aacbcowcnfw417.jpg "/>

Enter SB (' Debug.js ', 4) to set a breakpoint on line fourth of the function

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/59/A9/wKioL1TbEy_RnJYSAADhX5temIU231.jpg "title=" Image3.png "alt=" Wkiol1tbey_rnjysaadhx5temiu231.jpg "/>


Debugging with Elipse

Before using eclipse, first get a copy of Eclipse in http://www.eclipse.org/downloads/.
Start Eclipse, select Help→install New Software ... in the menu bar, and a setup dialog box opens.
Click on the button on the right to add ..., then open a dialog titled Add Repository
Enter Chrome Developer into the Http://chromedevtools.googlecode.com/svn/update/dev/,Name and then click the OK button.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/59/AD/wKiom1TbEmeSLAZ4AAJ8tuSgiOk432.jpg "title=" Image4.png "alt=" Wkiom1tbemeslaz4aaj8tusgiok432.jpg "/>

then select the Chrome Developer you just added in the combo box after work with, wait a moment, in the list
Select Google Chrome Developer Tools, then click Next,

Google Chrome Developer Tools
at this point, Eclipse calculates the packages and dependencies needed to install, click Next

read License, select I accept the terms of the License agreements, click Next,

then Eclipse will start the installation

after the installation is complete, Eclipse prompts you to restart to apply the update, click Restart NOW,V8 Debug Tool
the installation is complete.


2. Debugging a node. JS program using Eclipse
open a node. js code with Eclipse, and choose Debug Perspective to Go to debug view, as shown in 3-15.
Click the down triangle to the right of the debug icon in the toolbar and select Debug Configurations .... In the
on the left side of the configuration window, locate the standalone V8 VM and click on the new icon in the upper left corner to create a fresh configuration. In the
fill in the configuration with name, such as Nodedebug, and host and port. Click Apply App Configuration.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/59/AD/wKiom1TbEp7zDUKgAAIctIHRdVk314.jpg "title=" Image5.png "alt=" Wkiom1tbep7zdukgaaictihrdvk314.jpg "/>

Configuring debugging

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/AD/wKiom1TbErSxO0-9AADEpA-hQn4145.jpg "style=" float: none; "title=" Image6.png "alt=" Wkiom1tbersxo0-9aadepa-hqn4145.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/A9/wKioL1TbE6mj3u6kAAHxwnxTflI512.jpg "style=" float: none; "title=" Image7.png "alt=" Wkiol1tbe6mj3u6kaahxwnxtfli512.jpg "/>

Configuring Standalone V8 VMS
Next, start the Debug service to debug the script by using the node--debug-brk=5858 debug.js command
And then click the Debug button in the Eclipse's toolbar to start debugging

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/59/AD/wKiom1TbEwvyxSPLAALpIyGM7e8035.jpg "title=" Image8.png "alt=" Wkiom1tbewvyxsplaalpiygm7e8035.jpg "/>

This article is from "My dream Fly on the Sky" blog, please be sure to keep this source http://7915791.blog.51cto.com/7905791/1613746

(iv), node. js for program debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.