nod32用户名获取器

Let’s imagine that I have a simple JavaScript file and I want to calculate the sum of integer numbers but I have a problem and I want to debug this file(but I don’t want to use console.log as a debugger!)

假设我有一个简单JavaScript文件,我想计算整数的总和,但是遇到问题,我想调试该文件(但是我不想将console.log用作调试器!)

This is the file:

这是文件:

A simple function that we are going to debug.
我们将要调试的一个简单功能。

In order to use debug mode we need to run the file with this command:

为了使用调试模式,我们需要使用以下命令运行文件:

node inspect sumCalculator.js

Also, we can use this command but it is deprecated:

另外,我们可以使用此命令,但已弃用:

node debug sumCalculator.js

As we enter the debug mode we can see these lines on the console:

当我们进入调试模式时,我们可以在控制台上看到以下几行:

Nodejs debug mode
Node.js调试模式

As we can see debugger is listening on port 9229 and a unique URL. We are going to use this URL after we learn a few commands in debug mode.

如我们所见,调试器正在侦听端口9229和唯一的URL。 在调试模式下学习了一些命令之后,我们将使用此URL。

We can use the help command to see what we can do here: help

我们可以使用help命令来查看在这里可以做什么: help

Nodejs debug commands
Node.js调试命令

基本调试命令: (Basic debug commands:)

  • Resume execution(continue): c or cont

    恢复执行(续): ccont

  • Next line: n or next

    下一行: nnext

  • Step into a function: s or step

    步入函数: sstep

  • Step out: o or out

    跳出: oout

  • Set breakpoint: sb or setBreakpoint

    设置断点: sbsetBreakpoint

  • Clear breakpoint: sc or clearBreakpoint

    清除断点: scclearBreakpoint

The repl command gives us a repl mode command line and we have access to functions and variables in debug mode. (Or as Node.js docs define: Open debugger’s repl for evaluation in debugging script’s context)

repl命令为我们提供了repl模式命令行,并且我们可以在调试模式下访问函数和变量。 (或按Node.js文档的定义:打开调试器的repl以在调试脚本的上下文中进行评估)

让我们调试这个简单的文件 (Let’s debug this simple file)

First of all, we need a breakpoint. I think line 4 is the best place we can set a breakpoint. So in order to set a breakpoint at line 4, we need to execute this command: sb(4)

首先,我们需要一个断点。 我认为第4行是设置断点的最佳位置。 因此,为了在第4行设置断点,我们需要执行以下命令: sb(4)

Setting a breakpoint
设置断点

We can use cont command but what is the point if we cannot see variables?There are two ways to check variables in debug mode:

我们可以使用cont命令,但是如果看不到变量又有什么用呢?在调试模式下有两种检查变量的方法:

1. repl you have to enter repl mode and then you have access to variables and functions and you can check them.

1. repl您必须进入repl模式,然后才能访问变量和函数,并且可以对其进行检查。

2. Using watch.

2.使用watch

We are going to use the second way as it is a better way when we are in a loop:

我们将使用第二种方法,因为在循环中这是一种更好的方法:

watch('index')watch('sum')

Pay attention that the watch function expects a string.

注意watch函数需要一个字符串

As I start the debugger I might encounter with an error like this: sum is not defined and that’s OK since before reaching our breakpoint these variables are not defined.

当我启动调试器时,可能会遇到这样的错误: sum is not defined ,这没关系,因为在到达断点之前未定义这些变量。

If we use cont then we can see the values of these variables:

如果使用cont则可以看到这些变量的值:

Watching values
观察价值

So I guess the problem with my function is that I’m starting from 0!

所以我想我的函数的问题是我从0开始!

在浏览器中调试 (Debug inside the browser)

We want to use chrome dev tools to debug any script:

我们想使用chrome dev工具来调试任何脚本:

  1. Enter the debug mode: node inspect yourFile.js

    进入调试模式: node inspect yourFile.js

  2. Open chrome and in address bar type chrome://inspect.

    打开chrome,然后在地址栏中输入chrome://inspect

chrome inspect tool
镀Chrome检查工具

You can see that because of the port of debug mode chrome is watching this file and by clicking on the blue inspect text we can enter the debug mode in chrome:

您会看到由于调试模式的端口chrome正在监视此文件,并且通过单击蓝色的检查文本我们可以在chrome中进入调试模式:

chrome inspect tool
镀Chrome检查工具

Now you have access to all debugging options in a graphical way.

现在,您可以以图形方式访问所有调试选项。

翻译自: https://medium.com/javascript-in-plain-english/nodejs-built-in-debugger-856a9a3c054b

nod32用户名获取器


http://www.taodudu.cc/news/show-3169110.html

相关文章:

  • nod32用户名和密码每天更新_网络设备默认密码在线查询网站,你还不修改?
  • agilent3070 中 analog测试程序的写法
  • 三个故事,说穿了许多人
  • 给input[text]添加icon,并且绑定事件
  • webkit对接woff字体
  • 图片预览-放大镜效果
  • MediaPlayer 之音乐循环播放器
  • python运行微软图标代码_获取windows程序图标并将其另存为.png Python
  • 专访Pebble智能手表创始人:Pebble是这样诞生的
  • 微信小程序 点赞+评论(无限级评论回复)/带图评论解决方案
  • 傅里叶级数的理解与简单推导
  • 微信小程序用户头像昵称获取新规适配教程,用户自定义头像昵称
  • IOS学习003超级猜图--整合案例
  • asp.net笔试题
  • 9 | 小程序之样式WXSS
  • 很不错的两款icon图标选择组件
  • 中国公用计算机互联网的国际出口带宽量为,我国互联网络国际出口带宽已达18599M...
  • Internet互联网络提供的主要服务
  • 28、网络互联(网络层)
  • 开放式系统互联模型(网络的七层架构)
  • FRP搭建内网穿透服务器畅游Internet互联网络
  • 【计算机系统结构】第7章 互联网络
  • 最大计算机互联网络是,目前世界上最大的计算机互联网络是什么?
  • 互联网络——基本的单极互联网络
  • 规模较大的四大计算机互联网络,我国的四大互联网络是什么?
  • 震惊!深度揭秘互联网络!!!
  • react+antd 修改主题色
  • Vue实现渐变色进度条
  • 怎么让网页变成黑白色
  • html5黄游戏,HTML5游戏-看你有多色

nod32用户名获取器_内置调试器的nod​​ejs相关推荐

  1. 按照 「老毛桃limite」的“如何使用VirtualBox的内置调试器 VBoxDBG”,为什么无法设置断点,不能单步执行

    原文链接:https://blog.csdn.net/mzjmzjmzjmzj/article/details/89567030 内容如标题,这是virtual box 内置的调试器,无法用br设置断 ...

  2. Elasticsearch Analyzer 内置分词器

    Elasticsearch Analyzer 内置分词器 篇主要介绍一下 Elasticsearch中 Analyzer 分词器的构成 和一些Es中内置的分词器 以及如何使用它们 前置知识 es 提供 ...

  3. 我的世界服务器修改器1.7.10,我的世界修改器_我的世界TMI内置修改器1.7.10 - 99单机游戏...

    我的世界TMI内置修改器适用于1.7.10版本的我的世界,可以修改我的世界内部的参数,非常的有意思,想要的朋友欢迎前来下载. 安装方法: 1.有FORGE版 关闭Minecraft. 使用winrar ...

  4. 架构师成长记_第八周_10_ES-分词与五种内置分词器

    文章目录 ES-分词 PS: 1. 全局分析方式(_analyze) 2. 指定字段分析方式(索引名/_analyze) ES-五种内置分词器介绍 1 标准分词器 standard 2 非字母分词器 ...

  5. python的内置装饰器

    Python中总共包括三个内置装饰器: 1.staticmethod   (静态方法使用) 2. classmethod     (类方法) 3.property             (把类的方法 ...

  6. Elasticsearch7 分词器(内置分词器和自定义分词器)

    文章目录 Elasticsearch7 分词器(内置分词器和自定义分词器) analysis 概览 char_filter html_strip mapping pattern_replace fil ...

  7. Struts2内置拦截器和自定义拦截器

    内置拦截器 Struts2中内置类许多的拦截器,它们提供了许多Struts2的核心功能和可选的高级特性.这些内置的拦截器在struts-default.xml中配置.只有配置了拦截器,拦截器才可以正常 ...

  8. Python笔记-内置装饰器

    内置装饰器是指python中自己带的,不要程序员写的 如下代码: class Student(object):def __init__(self, name, score):self.name = n ...

  9. python中的json函数_python中装饰器、内置函数、json的详解

    装饰器 装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象. 先看简单例子: def run(): time.sleep(1 ...

最新文章

  1. poj3259(Bellman_ford算法)
  2. 图片怎么等比缩放_图片300kb,50kb压缩【方法笔记】
  3. boost signals2 coroutine
  4. 我的家乡-客家小山村
  5. ios修改了coredata数据结构后,更新安装会闪退
  6. 如何在生产环境下用好EFCore
  7. matplotlib的默认字体_浅谈matplotlib默认字体设置探索
  8. angular中如何定义全局变量_如何在Angular 2 / Typescript中声明全局变量?
  9. 深度学习笔记(37) 交并比
  10. 强化学习——From drew追寻Mitsuha的学习笔记
  11. C# winform 上传文件 (多种)
  12. 安卓 获取rtsp流 截屏_华为手机这5种截屏方法,你都会用吗?现在知道也不亏...
  13. Android成长的幕后推手:工程师鲁宾
  14. 给android开发者的rx,给Android开发者的RxJava 详解,解你多年困扰!
  15. Python 微信自动化工具开发系列05_根据用户信息自动回复(2022年10月可用)
  16. FPGA实现sobel边缘检测并Modelsim仿真,与MATLAB实现效果对比
  17. Windbg分析蓝屏Dump文件
  18. pfSense®与OPNsense®技术比较
  19. cesium制作飞机路线图
  20. 机器人仿真控制(以ABB为例)

热门文章

  1. AD18.1.9和AD18.1.7的安装步骤
  2. python读取tiff影像_python+tifffile之tiff文件读写方式
  3. mtkwin10驱动_修复:Win10系统MTK(MediaTek)VCOM USB驱动程序错误
  4. 【数据库】主键和外键的必要性
  5. 双二阶IIR滤波器——直接I型、直接II型C语言实现
  6. MQTT服务器EMQX的设置登录验证和客户端离在线通知
  7. ubuntu如何安装mysql客户端_Ubuntu安装mysql
  8. android json分页,移动测试之异步任务+JSON解析+ListView分页
  9. Linux环境问题_adb shell无法进入设备内部
  10. mysql导入access2016_php 导入mysql数据到access方法