- Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathgdb_helpers.po
430 lines (367 loc) · 18.2 KB
/
gdb_helpers.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2024, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Rafael Fontenelle <rffontenelle@gmail.com>, 2024
#
#,fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-01 16:38+0000\n"
"PO-Revision-Date: 2024-02-23 16:46+0000\n"
"Last-Translator: Rafael Fontenelle <rffontenelle@gmail.com>, 2024\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#:../../howto/gdb_helpers.rst:5
msgid"Debugging C API extensions and CPython Internals with GDB"
msgstr"使用 GDB 调试 C API 扩展和 CPython 内部代码"
#:../../howto/gdb_helpers.rst:9
msgid""
"This document explains how the Python GDB extension, ``python-gdb.py``, can "
"be used with the GDB debugger to debug CPython extensions and the CPython "
"interpreter itself."
msgstr""
"本文档介绍了如何将 Python GDB 扩展 ``python-gdb.py`` 与 GDB 调试器一起使用以调试 CPython 扩展以及 "
"CPython 解释器本身。"
#:../../howto/gdb_helpers.rst:13
msgid""
"When debugging low-level problems such as crashes or deadlocks, a low-level "
"debugger, such as GDB, is useful to diagnose and correct the issue. By "
"default, GDB (or any of its front-ends) doesn't support high-level "
"information specific to the CPython interpreter."
msgstr""
"当调试低层级问题如崩溃或死锁时,低层级的调试器如 GDB 适合被用来诊断和修正错误。 在默认情况下,GDB(或其任一种前端)并不支持 CPython "
"解释器专属的高层级信息。"
#:../../howto/gdb_helpers.rst:18
msgid""
"The ``python-gdb.py`` extension adds CPython interpreter information to GDB."
" The extension helps introspect the stack of currently executing Python "
"functions. Given a Python object represented by a :c:expr:`PyObject *` "
"pointer, the extension surfaces the type and value of the object."
msgstr""
"``python-gdb.py`` 扩展可向 GDB 添加 CPython 解释器信息。 该扩展能协助对当前执行的 Python 函数栈进行内省。 "
"当给定一个由 :c:expr:`PyObject *` 指针代表的 Python 对象时,该扩展将展示对象的类型和值。"
#:../../howto/gdb_helpers.rst:23
msgid""
"Developers who are working on CPython extensions or tinkering with parts of "
"CPython that are written in C can use this document to learn how to use the "
"``python-gdb.py`` extension with GDB."
msgstr""
"开发 CPython 扩展或处理 CPython 中用 C 语言编写的部分的开发人员可以通过本文档学习如何将 ``python-gdb.py`` 扩展与"
" GDB 一起使用。"
#:../../howto/gdb_helpers.rst:29
msgid""
"This document assumes that you are familiar with the basics of GDB and the "
"CPython C API. It consolidates guidance from the `devguide "
"<https://devguide.python.org>`_ and the `Python wiki "
"<https://wiki.python.org/moin/DebuggingWithGdb>`_."
msgstr""
"本文档假定你已熟悉 GDB 和 CPython C API 的基础知识。 它对来自 `devguide "
"<https://devguide.python.org>`_ 和 `Python wiki "
"<https://wiki.python.org/moin/DebuggingWithGdb>`_ 的内容进行了整合。"
#:../../howto/gdb_helpers.rst:36
msgid"Prerequisites"
msgstr"前提条件"
#:../../howto/gdb_helpers.rst:38
msgid"You need to have:"
msgstr"你需要有:"
#:../../howto/gdb_helpers.rst:40
msgid""
"GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the "
"CPython sources. Note that this file will be removed in Python 3.12.)"
msgstr""
#:../../howto/gdb_helpers.rst:42
msgid""
"GDB-compatible debugging information for Python and any extension you are "
"debugging."
msgstr"针对 Python 和你正在调试的任何扩展的 GDB 兼容调试信息。"
#:../../howto/gdb_helpers.rst:44
msgid"The ``python-gdb.py`` extension."
msgstr"``python-gdb.py`` 扩展。"
#:../../howto/gdb_helpers.rst:46
msgid""
"The extension is built with Python, but might be distributed separately or "
"not at all. Below, we include tips for a few common systems as examples. "
"Note that even if the instructions match your system, they might be "
"outdated."
msgstr""
"此扩展与 Python 一起构建,但可能单独发布或根本不发布。 下面,我们将以几个常见系统为例进行说明。 "
"请注意即使这些说明与你的系统相匹配,它们也可能已经过时。"
#:../../howto/gdb_helpers.rst:52
msgid"Setup with Python built from source"
msgstr"使用从源代码构建的 Python 进行设置"
#:../../howto/gdb_helpers.rst:54
msgid""
"When you build CPython from source, debugging information should be "
"available, and the build should add a ``python-gdb.py`` file to the root "
"directory of your repository."
msgstr""
"当你从源代码构建 CPython 时,调试信息应当是可用的,并且构建应当在你的代码库根目录中添加一个 ``python-gdb.py`` 文件。"
#:../../howto/gdb_helpers.rst:58
msgid""
"To activate support, you must add the directory containing ``python-gdb.py``"
" to GDB's \"auto-load-safe-path\". If you haven't done this, recent versions"
" of GDB will print out a warning with instructions on how to do this."
msgstr""
"要激活支持,你必须将包含 ``python-gdb.py`` 的目录添加到 GDB 的 \"auto-load-safe-path\" "
"中。如果你没有这样做,较新版本的 GDB 会打印一个警告来说明如何执行此操作。"
#:../../howto/gdb_helpers.rst:65
msgid""
"If you do not see instructions for your version of GDB, put this in your "
"configuration file (``~/.gdbinit`` or ``~/.config/gdb/gdbinit``)::"
msgstr""
"如果你没有看到针对你的 GDB 版本的说明,请将以下内容放到你的配置文件中 (``~/.gdbinit`` 或 "
"``~/.config/gdb/gdbinit``)::"
#:../../howto/gdb_helpers.rst:70
msgid"You can also add multiple paths, separated by ``:``."
msgstr"你还可以添加多个路径,以 ``:`` 分隔。"
#:../../howto/gdb_helpers.rst:74
msgid"Setup for Python from a Linux distro"
msgstr"针对 Linux 发行版的 Python 设置"
#:../../howto/gdb_helpers.rst:76
msgid""
"Most Linux systems provide debug information for the system Python in a "
"package called ``python-debuginfo``, ``python-dbg`` or similar. For example:"
msgstr""
"大多数 Linux 系统会在名为 ``python-debuginfo``、``python-dbg`` 或类似的包中提供系统 Python "
"的调试信息。 例如:"
#:../../howto/gdb_helpers.rst:80
msgid"Fedora:"
msgstr"Fedora:"
#:../../howto/gdb_helpers.rst:87
msgid"Ubuntu:"
msgstr"Ubuntu:"
#:../../howto/gdb_helpers.rst:93
msgid""
"On several recent Linux systems, GDB can download debugging symbols "
"automatically using *debuginfod*. However, this will not install the "
"``python-gdb.py`` extension; you generally do need to install the debug info"
" package separately."
msgstr""
"在一些最新的 Linux 系统上,GDB 可以使用 *debuginfod* 自动下载调试符号。 不过,这并不会安装 ``python-gdb.py``"
" 扩展;你通常需要单独安装调试信息包。"
#:../../howto/gdb_helpers.rst:100
msgid"Using the Debug build and Development mode"
msgstr"使用调试构建和开发模式"
#:../../howto/gdb_helpers.rst:102
msgid"For easier debugging, you might want to:"
msgstr"为了方便调试,你可能需要:"
#:../../howto/gdb_helpers.rst:104
msgid""
"Use a :ref:`debug build <debug-build>` of Python. (When building from "
"source, use ``configure --with-pydebug``. On Linux distros, install and run "
"a package like ``python-debug`` or ``python-dbg``, if available.)"
msgstr""
"使用 Python 的 :ref:`调试构建版 <debug-build>`。 (当从源代码构建时,使用 ``configure --with-"
"pydebug``。 在 Linux 发行版上,安装并运行 ``python-debug`` 或 ``python-dbg`` 之类的包,如果有的话。)"
#:../../howto/gdb_helpers.rst:107
msgid"Use the runtime :ref:`development mode <devmode>` (``-X dev``)."
msgstr"使用运行时 :ref:`开发模式 <devmode>` (``-X dev``)。"
#:../../howto/gdb_helpers.rst:109
msgid""
"Both enable extra assertions and disable some optimizations. Sometimes this "
"hides the bug you are trying to find, but in most cases they make the "
"process easier."
msgstr"两者都将启用额外的断言并禁用某些优化。 有时这会隐藏你想要查找的程序错误,但大多数情况下它们都能使调试过程更简单。"
#:../../howto/gdb_helpers.rst:115
msgid"Using the ``python-gdb`` extension"
msgstr"使用 ``python-gdb`` 扩展"
#:../../howto/gdb_helpers.rst:117
msgid""
"When the extension is loaded, it provides two main features: pretty printers"
" for Python values, and additional commands."
msgstr"当该扩展被加载时,它将提供两个主要特性:Python 值的美化打印,以及附加的命令。"
#:../../howto/gdb_helpers.rst:121
msgid"Pretty-printers"
msgstr"美化打印"
#:../../howto/gdb_helpers.rst:123
msgid""
"This is what a GDB backtrace looks like (truncated) when this extension is "
"enabled::"
msgstr"这是当此扩展被启用时 GDB 回溯信息的显示效果(截取部分)::"
#:../../howto/gdb_helpers.rst:142
msgid""
"Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed "
"as its ``repr()``, rather than an opaque ``PyObject *`` pointer."
msgstr""
"请注意传给 ``PyDict_GetItemString`` 的字典参数被显示为其 ``repr()``,而非不透明的 ``PyObject *`` "
"指针。"
#:../../howto/gdb_helpers.rst:145
msgid""
"The extension works by supplying a custom printing routine for values of "
"type ``PyObject *``. If you need to access lower-level details of an "
"object, then cast the value to a pointer of the appropriate type. For "
"example::"
msgstr""
"该扩展通过为类型 ``PyObject *`` 的值提供自定义的打印例程来发挥作用。 "
"如果你需要访问一个对象的低层级细节,则要将原值投射为适当类型的指针。 例如::"
#:../../howto/gdb_helpers.rst:168
msgid""
"Note that the pretty-printers do not actually call ``repr()``. For basic "
"types, they try to match its result closely."
msgstr"请注意美化打印并不会实际调用 ``repr()``。 对于基本类型,它将尝试尽量匹配其结果。"
#:../../howto/gdb_helpers.rst:171
msgid""
"An area that can be confusing is that the custom printer for some types look"
" a lot like GDB's built-in printer for standard types. For example, the "
"pretty-printer for a Python ``int`` (:c:expr:`PyLongObject *`) gives a "
"representation that is not distinguishable from one of a regular machine-"
"level integer::"
msgstr""
"一个可能令人困惑的地方是某些类型的自定义打印效果很像是 GDB 针对标准类型的内置打印形式。 例如,针对 Python ``int`` "
"(:c:expr:`PyLongObject *`) 的美化打印表示形式与机器层级上常规的整数并无区别::"
#:../../howto/gdb_helpers.rst:183
msgid""
"The internal structure can be revealed with a cast to :c:expr:`PyLongObject "
"*`:"
msgstr"内部结构可通过投射为 :c:expr:`PyLongObject *` 来显示:"
#:../../howto/gdb_helpers.rst:185
msgid""
"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = "
"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}"
msgstr""
"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = "
"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}"
#:../../howto/gdb_helpers.rst:189
msgid""
"A similar confusion can arise with the ``str`` type, where the output looks "
"a lot like gdb's built-in printer for ``char *``::"
msgstr"类似的困惑也可能发生于 ``str`` 类型,这里的输出看起来很像 gdb 针对 ``char *`` 的内置打印形式::"
#:../../howto/gdb_helpers.rst:195
msgid""
"The pretty-printer for ``str`` instances defaults to using single-quotes (as"
" does Python's ``repr`` for strings) whereas the standard printer for ``char"
" *`` values uses double-quotes and contains a hexadecimal address::"
msgstr""
"针对 ``str`` 实例的美化打印默认使用单引号(就像 Python 字符串的 ``repr`` 一样)而针对 ``char *`` "
"值的标准打印形式使用双引号并且包含一个十六进制的地址::"
#:../../howto/gdb_helpers.rst:202
msgid""
"Again, the implementation details can be revealed with a cast to "
":c:expr:`PyUnicodeObject *`::"
msgstr"同样地,该实现细节可通过投射为 :c:expr:`PyUnicodeObject *` 来显示::"
#:../../howto/gdb_helpers.rst:210
msgid"``py-list``"
msgstr"``py-list``"
#:../../howto/gdb_helpers.rst:212
msgid""
"The extension adds a ``py-list`` command, which lists the Python source code"
" (if any) for the current frame in the selected thread. The current line is"
" marked with a \">\"::"
msgstr""
"该扩展添加了一个 ``py-list`` 命令,它将列出选定的线程中当前帧的 Python 源代码(如果存在)。 当前行将以一个 \">\" 来标记::"
#:../../howto/gdb_helpers.rst:229
msgid""
"Use ``py-list START`` to list at a different line number within the Python "
"source, and ``py-list START,END`` to list a specific range of lines within "
"the Python source."
msgstr""
"使用 ``py-list START`` 从不同的行号开始列出 Python 源代码,而 ``py-list START,END`` "
"则从列出指定行范围内的 Python 源代码。"
#:../../howto/gdb_helpers.rst:234
msgid"``py-up`` and ``py-down``"
msgstr"``py-up`` 和 ``py-down``"
#:../../howto/gdb_helpers.rst:236
msgid""
"The ``py-up`` and ``py-down`` commands are analogous to GDB's regular ``up``"
" and ``down`` commands, but try to move at the level of CPython frames, "
"rather than C frames."
msgstr""
"``py-up`` 和 ``py-down`` 命令类似于 GDB 的常规 ``up`` 和 ``down`` 命令,但会尝试在 CPython "
"帧而不是 C 帧的层级上移动。"
#:../../howto/gdb_helpers.rst:240
msgid""
"GDB is not always able to read the relevant frame information, depending on "
"the optimization level with which CPython was compiled. Internally, the "
"commands look for C frames that are executing the default frame evaluation "
"function (that is, the core bytecode interpreter loop within CPython) and "
"look up the value of the related ``PyFrameObject *``."
msgstr""
"GDB 并不总是能够读取相关的帧信息,这取决于编译 CPython 时的优化级别。 在内部,这些命令会查找正在执行默认帧求值函数(即 CPython "
"内的的核心字节码解释器循环)的 C 帧并查找相关 ``PyFrameObject *`` 的值。"
#:../../howto/gdb_helpers.rst:246
msgid"They emit the frame number (at the C level) within the thread."
msgstr"它们将发出线程内的帧编号(在 C 层级上)。"
#:../../howto/gdb_helpers.rst:248../../howto/gdb_helpers.rst:298
msgid"For example::"
msgstr"例如:"
#:../../howto/gdb_helpers.rst:261
msgid"so we're at the top of the Python stack."
msgstr"这样我们位于 Python 栈的顶部。"
#:../../howto/gdb_helpers.rst:263
msgid""
"The frame numbers correspond to those displayed by GDB's standard "
"``backtrace`` command. The command skips C frames which are not executing "
"Python code."
msgstr"帧编号对应于 GDB 的 ``backtrace`` 命令所显示的内容。 该命令将跳过未在执行 Python 代码的 C 帧。"
#:../../howto/gdb_helpers.rst:267
msgid"Going back down::"
msgstr"向下回退::"
#:../../howto/gdb_helpers.rst:289
msgid"and we're at the bottom of the Python stack."
msgstr"现在我们位于 Python 栈的底部。"
#:../../howto/gdb_helpers.rst:293
msgid"``py-bt``"
msgstr"``py-bt``"
#:../../howto/gdb_helpers.rst:295
msgid""
"The ``py-bt`` command attempts to display a Python-level backtrace of the "
"current thread."
msgstr"``py-bt`` 命令会尝试显示当前线程的 Python 层级回溯。"
#:../../howto/gdb_helpers.rst:314
msgid""
"The frame numbers correspond to those displayed by GDB's standard "
"``backtrace`` command."
msgstr"帧编号对应于 GDB 的 ``backtrace`` 命令所显示的内容。"
#:../../howto/gdb_helpers.rst:318
msgid"``py-print``"
msgstr"``py-print``"
#:../../howto/gdb_helpers.rst:320
msgid""
"The ``py-print`` command looks up a Python name and tries to print it. It "
"looks in locals within the current thread, then globals, then finally "
"builtins::"
msgstr""
"``py-print`` 命令会查找一个 Python 名称并尝试打印它。 它将先在当前线程的 locals 中查找,然后是 globals,最后是 "
"builtins::"
#:../../howto/gdb_helpers.rst:335
msgid"``py-locals``"
msgstr"``py-locals``"
#:../../howto/gdb_helpers.rst:337
msgid""
"The ``py-locals`` command looks up all Python locals within the current "
"Python frame in the selected thread, and prints their representations::"
msgstr""
"``py-locals`` 命令会在选定的线程中查找当前 Python 帧内的所有 Python 的 locals,并打印它们的表示形式::"
#:../../howto/gdb_helpers.rst:347
msgid"Use with GDB commands"
msgstr"与 GDB 命令一起使用"
#:../../howto/gdb_helpers.rst:349
msgid""
"The extension commands complement GDB's built-in commands. For example, you "
"can use a frame numbers shown by ``py-bt`` with the ``frame`` command to go "
"a specific frame within the selected thread, like this::"
msgstr""
"这些扩展命令是对 GDB 的内置命令的补充。 例如,你可以使用 ``py-bt`` 显示的帧编号与 ``frame`` "
"命令一起使用以转到所选线程中的特定帧,如下所示::"
#:../../howto/gdb_helpers.rst:368
msgid""
"The ``info threads`` command will give you a list of the threads within the "
"process, and you can use the ``thread`` command to select a different one::"
msgstr"``info threads`` 命令将向你提供进程内的线程列表,您还可以使用 ``thread`` 命令来选择不同的线程::"
#:../../howto/gdb_helpers.rst:376
msgid""
"You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to"
" run a command on all threads. With ``py-bt``, this lets you see what every"
" thread is doing at the Python level::"
msgstr""
"你可以使用 ``thread apply all COMMAND`` 或 (简短写法 ``t a a COMMAND``) 在所有线程上运行一个命令。 "
"配合 ``py-bt``,这将让你在 Python 层级上查看看到每个线程在做什么::"