Skip to content

Commit 8c628ac

Browse files
authored
docs: Provide CN translation for 3 additionalfeatures docs (#1357)
1 parent 1c88697 commit 8c628ac

File tree

6 files changed

+171
-32
lines changed

6 files changed

+171
-32
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
Configuring Clang Toolchain
2-
===========================
1+
Clang Toolchain Configuration
2+
=============================
3+
4+
:link_to_translation:`zh_CN:[中文]`
35

46
1. After creating a new project, edit the project configuration.
57

68
.. image:: https://user-images.githubusercontent.com/24419842/194882285-9faadb5d-0fe2-4012-bb6e-bc23dedbdbd2.png
79
:alt: Project Configuration
810

9-
2. Go to the ``Build Settings`` tab and select the clang toolchain:
11+
2. Go to the ``Build Settings`` tab and select the Clang toolchain.
1012

1113
.. image:: https://user-images.githubusercontent.com/24419842/194882462-3c0fd660-b223-4caf-964d-58224d91b518.png
1214
:alt: Clang Toolchain Selection
1315

1416
.. note::
15-
Clang toolchain is currently an experimental feature, and you may encounter build issues due to incompatibility with ESP-IDF. The following describes how to address the most common build issues on the current ESP-IDF master (ESP-IDF v5.1-dev-992-gaf28c1fa21-dirty). To work around clang build errors, please refer to `this workaround guide <https://github.com/espressif/idf-eclipse-plugin/blob/master/WORKAROUNDS.md#clang-toolchain-buid-errors>`_.
17+
18+
The Clang toolchain is currently an experimental feature, and you may encounter build issues due to incompatibility with ESP-IDF. The following describes how to address the most common build issues on the current ESP-IDF master (ESP-IDF v5.1-dev-992-gaf28c1fa21-dirty). For additional Clang-related build errors, please refer to the `workaround guide <https://github.com/espressif/idf-eclipse-plugin/blob/master/WORKAROUNDS.md#clang-toolchain-buid-errors>`_.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
ESP-IDF Terminal
2-
===============================
2+
================
33

4-
This would launch a local terminal with all the environment variables set under ``Preferences`` > ``C/C++`` > ``Build`` > ``Environment``. The default working directory would be either the currently selected project or ``IDF_PATH`` if there is no project selected.
4+
:link_to_translation:`zh_CN:[中文]`
5+
6+
This launches a local terminal with all environment variables configured under ``Preferences`` > ``C/C++`` > ``Build`` > ``Environment``. The default working directory would be either the currently selected project or ``IDF_PATH`` if no project selected.
57

68
The terminal ``PATH`` is also configured with ``esptool``, ``espcoredump``, ``partition_table``, and ``app_update`` component paths, so it is convenient to access them directly from the ESP-IDF terminal.
79

810
To launch the ESP-IDF Terminal:
911

10-
- Click on the ``Open a Terminal`` icon from the toolbar.
11-
- Choose ``ESP-IDF Terminal`` from the terminal drop-down and click ``OK`` to launch a terminal.
12+
1. Click on the ``Open a Terminal`` icon from the toolbar.
13+
2. Choose ``ESP-IDF Terminal`` from the terminal drop-down and click ``OK`` to launch a terminal.
1214

1315
.. image:: ../../../media/idf_terminal.png
1416
:alt: ESP-IDF Terminal

docs/en/additionalfeatures/heaptracing.rst

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,85 +3,93 @@
33
Heap Tracing
44
============
55

6-
Heap tracing enables you to monitor memory usage over time by generating and analyzing a `svdat` dump file. The IDF Eclipse Plugin supports generating heap trace files through special breakpoints. For more information on SDK-level configuration and tracing features, refer to the official `ESP-IDF documentation <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/heap_debug.html>`_.
6+
:link_to_translation:`zh_CN:[中文]`
7+
8+
Heap tracing allows you to monitor memory usage over time by generating and analyzing a ``svdat`` dump file. The IDF Eclipse Plugin supports generating heap trace files by setting special breakpoints. For more information on SDK-level configuration and tracing features, refer to the official `ESP-IDF documentation <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/heap_debug.html>`_.
79

810
Generating Dump File
911
--------------------
10-
1. **Open the sysview\_heap\_log.c file**
12+
13+
1. **Open the sysview_heap_log.c File**
1114

12-
From the Project Explorer, locate and open the `sysview_heap_log.c` file from the **system** templates project.
15+
From the Project Explorer, locate and open the ``sysview_heap_log.c`` file from the **system** templates project.
1316

1417
.. image:: ../../../media/HeapTracing/sysview_heap_log_file.PNG
1518
:alt: sysview_heap_log.c file
1619

1720
2. **Add a Breakpoint and Configure Properties**
1821

19-
Add a breakpoint at the desired line, then right-click on the breakpoint icon in the editor and select `Breakpoint Properties`.
22+
Add a breakpoint at the desired line, then right-click on the breakpoint icon in the editor and select ``Breakpoint Properties``.
2023

2124
.. image:: ../../../media/HeapTracing/breakpoint_properties_popup.png
2225
:alt: Breakpoint Properties
2326

2427
3. **Define Heap Tracing Action**
2528

26-
In the Breakpoint Properties window, go to `Actions`, click `New`, and select `Heap Tracing` from the `Action Type` dropdown.
27-
- For the initial breakpoint, set the action to **Start Heap Trace** and specify the save location for the dump file (recommended to store in the project directory). Name the action meaningfully, then click OK.
29+
In the ``Breakpoint Properties`` window, go to ``Actions``, click ``New``, and select ``Heap Tracing`` from the ``Action Type`` dropdown.
30+
31+
For the initial breakpoint, set the ``Action`` to ``Start Heap Trace`` and specify the save location for the dump file (it is recommended to store it in the project directory). Name the action meaningfully, then click ``OK``.
2832

2933
.. image:: ../../../media/HeapTracing/heap_tracing_action.png
3034
:alt: Heap Tracing Action
3135

3236
4. **Attach the Action to the Breakpoint**
3337

34-
After creating the action, click `Attach` to link it to the breakpoint, which will display it under the Actions for this breakpoint section.
38+
After creating the action, click ``Attach`` to link it to the breakpoint, which will display the action under the ``Actions for this breakpoint`` section.
3539

3640
.. image:: ../../../media/HeapTracing/breakpoint_properties_actions_start_attached.png
3741
:alt: Attach Action
3842

3943
5. **Apply and Create Additional Breakpoint**
4044

41-
Now you have a breakpoint that will start tracing and generate a dump file. To stop the tracing, create another breakpoint (e.g., at line 102), set its properties, and choose the **Stop Heap Trace** option in the action settings. Attach this action to the breakpoint as shown below.
45+
Now you have a breakpoint that will start tracing and generate a dump file. To stop the tracing, create another breakpoint (e.g., at line 102), set its properties, and choose the ``Stop Heap Trace`` option in the action settings. Attach this action to the breakpoint as shown below.
4246

4347
.. image:: ../../../media/HeapTracing/breakpoint_properties_actions_stop_attached.png
4448
:alt: Stop Heap Trace Action
4549

4650
6. **Launch Debug Configuration**
4751

48-
Launch the debug configuration for your ESP32 board. When the program hits the breakpoints, the IDE will prompt you to switch to the debugger perspective. Continue execution for each breakpoint to start and stop tracing. Refresh the project in the Project Explorer to view the dump file in the specified location.
52+
Launch the debug configuration for your ESP32 board. When a breakpoint is hit, the IDE will prompt you to switch to the debugger perspective. Continue execution at each breakpoint to start or stop tracing, then refresh the project in the Project Explorer to view the dump file at the specified location.
4953

5054
Analyzing the Dump File
5155
-----------------------
5256

53-
The IDF Eclipse Plugin allows you to analyze generated `svdat` dump files. Right-click on the dump file and select `Heap Dump Analysis` from the context menu.
57+
The IDF Eclipse Plugin allows you to analyze generated ``svdat`` dump files. Right-click on the dump file and select ``ESP-IDF: Heap Dump Analysis`` from the context menu.
5458

55-
**Note:** Ensure the project is built with the appropriate symbols file to enable analysis.
59+
.. note::
60+
61+
Ensure the project is built with the appropriate symbols file to enable analysis.
5662

5763
.. image:: ../../../media/HeapTracing/analysis_context_menu.png
5864
:alt: Heap Dump Analysis Context Menu
5965

60-
Overview Tab
61-
-------------
62-
The Overview Tab displays memory consumption over time in a graph format. By default, all contexts are shown; you can select specific contexts corresponding to heap events.
66+
``Overview`` Tab
67+
----------------
68+
69+
The ``Overview`` Tab displays memory consumption over time in a graph format. By default, all contexts are shown, but you can select specific contexts corresponding to heap events.
6370

6471
.. image:: ../../../media/HeapTracing/overview_tab_tracing.png
6572
:alt: Memory Consumption Graph
6673

67-
For example, selecting multiple contexts displays them separately on the graph.
74+
For example, selecting multiple contexts displays each of them separately on the graph.
6875

6976
.. image:: ../../../media/HeapTracing/overview_tab_tracing_contexts.png
7077
:alt: Selected Contexts in Graph
7178

72-
Details Tab
73-
-------------
74-
The Details Tab provides further insights, showing each event in the heap trace. Rows highlighted in light orange indicate potential memory leaks (since the trace may have ended before a free event was detected). Green rows show free heap events.
79+
``Details`` Tab
80+
---------------
81+
82+
The ``Details`` Tab provides further insights by showing each event in the heap trace. Rows highlighted in light orange indicate potential memory leaks, as the trace may have ended before a corresponding free event was detected. Rows highlighted in green indicate free heap events.
7583

7684
.. image:: ../../../media/HeapTracing/details_tab_tracing.png
7785
:alt: Details Tab
7886

79-
To filter entries for possible memory leaks, check the `View Possible Memory Leaks` box. Right-clicking on any entry allows you to view callers, opening the `Callers View` to display the call stack for the heap event.
87+
To filter entries for possible memory leaks, check the ``View Possible Memory Leaks`` box. Right-clicking on any entry allows you to view its callers by opening the ``Callers View``, which displays the call stack for the heap event.
8088

8189
.. image:: ../../../media/HeapTracing/show_callers_context_menu.png
8290
:alt: Show Callers
8391

84-
Clicking on an entry in the `Callers View` will navigate to the corresponding line in the source file.
92+
Clicking on an entry in the ``Callers View`` will navigate to the corresponding line in the source file.
8593

8694
.. image:: ../../../media/HeapTracing/callers_view.png
87-
:alt: Callers View
95+
:alt: Callers View
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
.. include:: ../../en/additionalfeatures/clangtoolchain.rst
1+
配置 Clang 工具链
2+
=================
3+
4+
:link_to_translation:`en:[English]`
5+
6+
1. 创建新项目后,编辑项目配置。
7+
8+
.. image:: https://user-images.githubusercontent.com/24419842/194882285-9faadb5d-0fe2-4012-bb6e-bc23dedbdbd2.png
9+
:alt: 项目配置
10+
11+
2. 前往 ``Build Settings`` 选项卡并选择 Clang 工具链。
12+
13+
.. image:: https://user-images.githubusercontent.com/24419842/194882462-3c0fd660-b223-4caf-964d-58224d91b518.png
14+
:alt: 选择 Clang 工具链
15+
16+
.. note::
17+
18+
Clang 工具链目前处于实验阶段,使用时可能会因为与 ESP-IDF 不兼容而遇到构建问题。以下内容说明了如何解决当前 ESP-IDF master 分支 (ESP-IDF v5.1-dev-992-gaf28c1fa21-dirty) 上最常见的构建问题。若遇到 Clang 构建错误,请参考此 `变通方法指南 <https://github.com/espressif/idf-eclipse-plugin/blob/master/WORKAROUNDS_CN.md>`_。
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
.. include:: ../../en/additionalfeatures/esp-terminal.rst
1+
ESP-IDF 终端
2+
============
3+
4+
:link_to_translation:`en:[English]`
5+
6+
该功能会启动一个本地终端,其中配置了在 ``Preferences`` > ``C/C++`` > ``Build`` > ``Environment`` 下的所有环境变量。默认工作目录为当前选中的项目;如果没有选中项目,则为 ``IDF_PATH``。
7+
8+
该终端的 ``PATH`` 还配置了 ``esptool``、``espcoredump``、``partition_table`` 和 ``app_update`` 组件的路径,便于在 ESP-IDF 终端中直接访问这些组件。
9+
10+
可参照下列步骤启动 ESP-IDF 终端:
11+
12+
1. 在工具栏中点击 ``Open a Terminal`` 图标。
13+
2. 在终端下拉菜单中选择 ``ESP-IDF Terminal``,然后点击 ``OK`` 启动终端。
14+
15+
.. image:: ../../../media/idf_terminal.png
16+
:alt: ESP-IDF 终端
Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,95 @@
1-
.. include:: ../../en/additionalfeatures/heaptracing.rst
1+
.. _heap_tracing:
2+
3+
堆跟踪
4+
======
5+
6+
:link_to_translation:`en:[English]`
7+
8+
你可以使用堆跟踪生成并分析 ``svdat`` 转储文件,持续监控内存使用情况。IDF Eclipse 插件支持通过设置特定断点来生成堆跟踪文件。有关 SDK 级配置和跟踪功能的更多信息,请参阅官方 `ESP-IDF 文档 <https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/api-reference/system/heap_debug.html>`_。
9+
10+
生成转储文件
11+
------------
12+
13+
1. **打开 sysview_heap_log.c 文件**
14+
15+
在资源管理器中找到并打开 **系统** 模板项目中的 ``sysview_heap_log.c`` 文件。
16+
17+
.. image:: ../../../media/HeapTracing/sysview_heap_log_file.PNG
18+
:alt: sysview_heap_log.c 文件
19+
20+
2. **添加断点并配置属性**
21+
22+
在所需的代码行添加一个断点,然后在编辑器中右键单击断点图标,选择 ``Breakpoint Properties``。
23+
24+
.. image:: ../../../media/HeapTracing/breakpoint_properties_popup.png
25+
:alt: 断点属性
26+
27+
3. **定义堆跟踪操作**
28+
29+
在 ``Breakpoint Properties`` 窗口中,前往 ``Actions``,单击 ``New``,并在 ``Action Type`` 下拉列表中选择 ``Heap Tracing``。
30+
31+
对于初始断点,在 ``Action`` 一栏选择 ``Start Heap Trace``,并指定转储文件的保存位置(建议存放在项目目录)。为该操作设置一个有意义的名称,然后单击 ``OK``。
32+
33+
.. image:: ../../../media/HeapTracing/heap_tracing_action.png
34+
:alt: 堆跟踪操作
35+
36+
4. **将该操作附加至断点**
37+
38+
创建操作后,单击 ``Attach`` 将其链接至断点。绑定成功后,该操作会显示在 ``Actions for this breakpoint`` 一栏。
39+
40+
.. image:: ../../../media/HeapTracing/breakpoint_properties_actions_start_attached.png
41+
:alt: 附加操作
42+
43+
5. **应用并创建另一个断点**
44+
45+
现在你已有一个会开始跟踪并生成转储文件的断点。要停止跟踪,请再创建一个断点(例如在代码的第 102 行),设置其属性,并在操作设置中选择 ``Stop Heap Trace`` 选项。按下图所示,将此操作附加至断点。
46+
47+
.. image:: ../../../media/HeapTracing/breakpoint_properties_actions_stop_attached.png
48+
:alt: 停止堆跟踪操作
49+
50+
6. **启动调试配置**
51+
52+
在 IDE 中启动开发板的调试配置。当程序运行至断点时,IDE 会提示你切换到调试器视图。在每个断点处继续执行程序,以开始或停止跟踪。然后在资源管理器中刷新项目,即可在指定位置查看生成的转储文件。
53+
54+
分析转储文件
55+
------------
56+
57+
IDF Eclipse 插件可用于分析生成的 ``svdat`` 转储文件。右键单击该转储文件,并在上下文菜单中选择 ``ESP-IDF: Heap Dump Analysis``。
58+
59+
.. note::
60+
61+
确保项目使用合适的符号文件进行构建,以便启用分析。
62+
63+
.. image:: ../../../media/HeapTracing/analysis_context_menu.png
64+
:alt: 堆转储分析的上下文菜单
65+
66+
``Overview`` 标签页
67+
-------------------
68+
69+
``Overview`` 标签页以曲线图形式显示内存消耗的变化情况。默认情况下,图表会显示所有上下文的内存信息,你也可以选择只显示与特定堆事件相关的上下文。
70+
71+
.. image:: ../../../media/HeapTracing/overview_tab_tracing.png
72+
:alt: 内存消耗图
73+
74+
例如,选择多个上下文时,曲线图会分别显示每个上下文的内存使用情况。
75+
76+
.. image:: ../../../media/HeapTracing/overview_tab_tracing_contexts.png
77+
:alt: 图表中已选的上下文
78+
79+
``Details`` 标签页
80+
------------------
81+
82+
``Details`` 标签页提供更详细的信息,显示堆跟踪中的每个事件。浅橙色高亮的行表示潜在的内存泄漏,因为跟踪可能在释放事件被检测到之前就已结束。绿色高亮的行表示已释放的堆事件。
83+
84+
.. image:: ../../../media/HeapTracing/details_tab_tracing.png
85+
:alt: 详细信息标签页
86+
87+
要筛选可能的内存泄漏条目,请勾选 ``View Possible Memory Leaks`` 复选框。右键单击任意条目可查看其调用者,这会打开 ``Callers View``,显示该堆事件的调用栈。
88+
89+
.. image:: ../../../media/HeapTracing/show_callers_context_menu.png
90+
:alt: 显示调用者
91+
92+
在 ``Callers View`` 中单击某个条目将跳转到源文件中的相应代码行。
93+
94+
.. image:: ../../../media/HeapTracing/callers_view.png
95+
:alt: 调用者视图

0 commit comments

Comments
 (0)