Skip to content

zh-CN:Trans for Debugging #4807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locale/zh-cn/docs/guides/diagnostics/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ layout: docs.hbs
以下即是相关的系列诊断指南:

* [内存诊断相关](/zh-cn/docs/guides/diagnostics/memory)
* [在线调试](/zh-cn/docs/guides/diagnostics/live-debugging)
29 changes: 29 additions & 0 deletions locale/zh-cn/docs/guides/diagnostics/live-debugging/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Live Debugging
layout: docs.hbs
---

# 在线调试

* [在线调试](#live-debugging)
* [我的程序没有以预期方式工作](#my-application-doesnt-behave-as-expected)
* [表现症状](#symptoms)
* [如何调试](#debugging)

你将在本文中学到如何在线调试 Node.js 进程。

## <!--my-application-doesnt-behave-as-expected-->我的程序没有以预期方式工作

### <!--symptoms-->表现症状

用户或许已经观察到对于特定的输入,程序无法输出预期值。举个例子:一个 HTTP 服务以 JSON
格式返回数据,但某些字段却是空的。许多错误的原因皆可导致此问题的发生,不过在本示例中,我们
着重关注程序的逻辑以及如何修复。

### <!--debugging-->如何调试

在本示例中,用户需要理解“程序路径”:它表示为响应一个特定的触发,应用程序所执行的路径(例如:HTTP
请求路径)。同时用户也希望通过“走单步”的方式贯穿整个代码,顺便控制代码的执行流程,以及观察
内存中变量中到底存储了什么数据。预知详情,可以点击下面的链接:

* [使用内存检查器](/zh-cn/docs/guides/diagnostics/live-debugging/using-inspector)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Using Inspector
layout: docs.hbs
---

# 使用内存检查器

在本地环境中,当我们谈到“在线调试”时,这意味着把我们的程序附加到调试器上,然后在代码里加
若干断点从而挂起正常的程序执行。然后我们单步调试完整个代码路径,观察不同单步时堆的变化。
不过在生产环境中使用调试器于我们而言并不是一个可选项,因为我们限制了该机器的访问权限,同时
我们也无法打断正常的工作执行流。道理很简单:因为它正在处理与公司业务逻辑相关的重要任务。

## 如何使用?

https://nodejs.org/zh-cn/docs/guides/debugging-getting-started/