From 3a1122a86eb43beeb35f1ee031f321dee4639fe4 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Sun, 12 May 2024 01:06:30 +0800 Subject: [PATCH] feat: translate `howto/gdb_helpers.po` --- howto/gdb_helpers.po | 151 ++++++++++++++++++++++++++++++++----------- 1 file changed, 112 insertions(+), 39 deletions(-) diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 2d8f2205a3..3f525c2a03 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -1,17 +1,17 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # -#, fuzzy +# Translators: +# Matt Wang , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-02-24 00:03+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2024-05-11 14:42+0800\n" +"Last-Translator: Matt Wang \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,7 +19,7 @@ msgstr "" #: ../../howto/gdb_helpers.rst:5 msgid "Debugging C API extensions and CPython Internals with GDB" -msgstr "" +msgstr "使用 GDB 來為 C API 擴充功能和 CPython 內部偵錯" #: ../../howto/gdb_helpers.rst:9 msgid "" @@ -27,6 +27,8 @@ msgid "" "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 "" @@ -35,6 +37,8 @@ msgid "" "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 "" @@ -43,6 +47,9 @@ msgid "" "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`` 擴充功能將 CPython 直譯器資訊新增至 GDB。此擴充有助於內省 " +"(introspect) 目前執行的 Python 函式的堆疊。給定一個由 :c:expr:`PyObject *` 指" +"標表示的 Python 物件,擴充功能會顯示該物件的型別和值。" #: ../../howto/gdb_helpers.rst:23 msgid "" @@ -50,6 +57,8 @@ msgid "" "CPython that are written in C can use this document to learn how to use the " "``python-gdb.py`` extension with GDB." msgstr "" +"正在開發 CPython 擴充功能或修補用 C 編寫之 CPython 部分的開發人員可以使用本文" +"件來學習如何將 ``python-gdb.py`` 擴充功能與 GDB 一起使用。" #: ../../howto/gdb_helpers.rst:29 msgid "" @@ -58,30 +67,35 @@ msgid "" "python.org>`_ and the `Python wiki `_." msgstr "" +"本文件假設你熟悉 GDB 和 CPython C API 的基礎知識。它整合了 `devguide " +"`_ 和 `Python wiki `_ 的指引。" #: ../../howto/gdb_helpers.rst:36 msgid "Prerequisites" -msgstr "" +msgstr "先決條件" #: ../../howto/gdb_helpers.rst:38 msgid "You need to have:" -msgstr "" +msgstr "你需要有:" #: ../../howto/gdb_helpers.rst:40 msgid "" "GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the " "sources of Python 3.11 or earlier.)" msgstr "" +"GDB 7 或更高版本。(對於早期版本的 GDB,請參閱 Python 3.11 或更早版本的原始程" +"式碼中的 ``Misc/gdbinit`` 。)" #: ../../howto/gdb_helpers.rst:42 msgid "" "GDB-compatible debugging information for Python and any extension you are " "debugging." -msgstr "" +msgstr "Python 和你正在偵錯的任何擴充功能的 GDB 相容偵錯資訊。" #: ../../howto/gdb_helpers.rst:44 msgid "The ``python-gdb.py`` extension." -msgstr "" +msgstr "``python-gdb.py`` 擴充。" #: ../../howto/gdb_helpers.rst:46 msgid "" @@ -89,10 +103,12 @@ msgid "" "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 "" +msgstr "使用從原始碼建置的 Python 進行設定" #: ../../howto/gdb_helpers.rst:54 msgid "" @@ -100,6 +116,8 @@ msgid "" "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 "" @@ -107,34 +125,41 @@ msgid "" "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 "" +msgstr "你也可以新增多個路徑,要以 ``:`` 分隔。" #: ../../howto/gdb_helpers.rst:74 msgid "Setup for Python from a Linux distro" -msgstr "" +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 "" +msgstr "Fedora:" #: ../../howto/gdb_helpers.rst:87 msgid "Ubuntu:" -msgstr "" +msgstr "Ubuntu:" #: ../../howto/gdb_helpers.rst:93 msgid "" @@ -143,14 +168,16 @@ msgid "" "``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 "" +msgstr "使用偵錯建置和開發模式" #: ../../howto/gdb_helpers.rst:102 msgid "For easier debugging, you might want to:" -msgstr "" +msgstr "為了更輕鬆地進行偵錯,你可能需要:" #: ../../howto/gdb_helpers.rst:104 msgid "" @@ -158,10 +185,13 @@ msgid "" "source, use ``configure --with-pydebug``. On Linux distros, install and run " "a package like ``python-debug`` or ``python-dbg``, if available.)" msgstr "" +"使用 Python 的\\ :ref:`偵錯建置 `。(從原始碼建置時,請使用 " +"``configure --with-pydebug``。在 Linux 發行版上,安裝並執行諸如 ``python-" +"debug`` 或 ``python-dbg`` 之類的套件(如果可用))。" #: ../../howto/gdb_helpers.rst:107 msgid "Use the runtime :ref:`development mode ` (``-X dev``)." -msgstr "" +msgstr "使用 runtime :ref:`開發模式 ` (``-X dev``)。" #: ../../howto/gdb_helpers.rst:109 msgid "" @@ -169,32 +199,36 @@ msgid "" "hides the bug you are trying to find, but in most cases they make the " "process easier." msgstr "" +"兩者都啟用額外的斷言 (assertion) 並停用一些最佳化。有時這會隱藏你試圖想尋找的" +"錯誤,但在大多數情況下,它們會使過程變得更容易。" #: ../../howto/gdb_helpers.rst:115 msgid "Using the ``python-gdb`` extension" -msgstr "" +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 "" +msgstr "載入擴充功能後,它提供兩個主要功能:Python 值的漂亮列印器和附加命令。" #: ../../howto/gdb_helpers.rst:121 msgid "Pretty-printers" -msgstr "" +msgstr "漂亮列印器" #: ../../howto/gdb_helpers.rst:123 msgid "" "This is what a GDB backtrace looks like (truncated) when this extension is " "enabled::" -msgstr "" +msgstr "這是啟用此擴充功能時 GDB 回溯 (backtrace) 的樣子(有被截斷):" #: ../../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 "" @@ -203,12 +237,16 @@ msgid "" "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 "" @@ -218,24 +256,31 @@ msgid "" "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 "" +msgstr "可以透過轉換 (cast) 為 :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`` 型別也會出現類似的混亂,其中的輸出看起來很像對於 ``char *`` 的 gdb 內" +"建列印器 : ::" #: ../../howto/gdb_helpers.rst:195 msgid "" @@ -243,16 +288,18 @@ msgid "" "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 "" +msgstr "同樣,可以透過轉換為 :c:expr:`PyUnicodeObject *` 來揭示實作細節: ::" #: ../../howto/gdb_helpers.rst:210 msgid "``py-list``" -msgstr "" +msgstr "``py-list``" #: ../../howto/gdb_helpers.rst:212 msgid "" @@ -260,6 +307,8 @@ msgid "" "(if any) for the current frame in the selected thread. The current line is " "marked with a \">\"::" msgstr "" +"該擴充功能新增了一個 ``py-list`` 命令,該命令列出了所選執行緒中當前 frame 的 " +"Python 原始程式碼(如果有)。當前的列會標有 \">\": ::" #: ../../howto/gdb_helpers.rst:229 msgid "" @@ -267,10 +316,12 @@ msgid "" "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 "" +msgstr "``py-up`` 和 ``py-down``" #: ../../howto/gdb_helpers.rst:236 msgid "" @@ -278,6 +329,8 @@ msgid "" "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 frame 層級移動,而不是 C frame。" #: ../../howto/gdb_helpers.rst:240 msgid "" @@ -287,18 +340,21 @@ msgid "" "function (that is, the core bytecode interpreter loop within CPython) and " "look up the value of the related ``PyFrameObject *``." msgstr "" +"GDB 並不總是能夠讀取相關的 frame 資訊,這取決於編譯 CPython 的最佳化等級。在" +"內部,這些指令會尋找正在執行預設 frame 計算 (evaluation) 函式(即 CPython 中" +"迴圈的核心位元組碼直譯器)的 C frame,並尋找相關 ``PyFrameObject *`` 的值。" #: ../../howto/gdb_helpers.rst:246 msgid "They emit the frame number (at the C level) within the thread." -msgstr "" +msgstr "它們在執行緒內發出(於 C 層級的)frame 編號。" #: ../../howto/gdb_helpers.rst:248 ../../howto/gdb_helpers.rst:320 msgid "For example::" -msgstr "" +msgstr "例如: ::" #: ../../howto/gdb_helpers.rst:261 msgid "so we're at the top of the Python stack." -msgstr "" +msgstr "所以我們處於 Python 堆疊的頂端。" #: ../../howto/gdb_helpers.rst:263 msgid "" @@ -306,14 +362,16 @@ msgid "" "``backtrace`` command. The command skips C frames which are not executing " "Python code." msgstr "" +"frame 編號與 GDB 標準 ``backtrace`` 指令顯示的 frame 編號相對應。此指令會跳過" +"不執行 Python 程式碼的 C frame。" #: ../../howto/gdb_helpers.rst:267 msgid "Going back down::" -msgstr "" +msgstr "回到下面: ::" #: ../../howto/gdb_helpers.rst:289 msgid "and we're at the bottom of the Python stack." -msgstr "" +msgstr "我們處於 Python 堆疊的底部。" #: ../../howto/gdb_helpers.rst:291 msgid "" @@ -321,26 +379,29 @@ msgid "" "multiple Python stack frames. This means that ``py-up`` and ``py-down`` may " "move multiple Python frames at once. For example::" msgstr "" +"請注意,在 Python 3.12 及更高版本中,同一個 C 堆疊 frame 可用於多個 Python 堆" +"疊 frame。這意味著 ``py-up`` 和 ``py-down`` 可以一次移動多個 Python frame。例" +"如: ::" #: ../../howto/gdb_helpers.rst:315 msgid "``py-bt``" -msgstr "" +msgstr "``py-bt``" #: ../../howto/gdb_helpers.rst:317 msgid "" "The ``py-bt`` command attempts to display a Python-level backtrace of the " "current thread." -msgstr "" +msgstr "``py-bt`` 指令嘗試顯示目前執行緒的 Python 層級回溯。" #: ../../howto/gdb_helpers.rst:336 msgid "" "The frame numbers correspond to those displayed by GDB's standard " "``backtrace`` command." -msgstr "" +msgstr " frame 編號與 GDB 標準 ``backtrace`` 指令顯示的 frame 編號相對應。" #: ../../howto/gdb_helpers.rst:340 msgid "``py-print``" -msgstr "" +msgstr "``py-print``" #: ../../howto/gdb_helpers.rst:342 msgid "" @@ -348,32 +409,37 @@ msgid "" "looks in locals within the current thread, then globals, then finally " "builtins::" msgstr "" +"``py-print`` 命令查找 Python 名稱並嘗試列印它。它在當前執行緒中尋找局部變數," +"然後是全域變數,最後是內建變數: ::" #: ../../howto/gdb_helpers.rst:356 msgid "" "If the current C frame corresponds to multiple Python frames, ``py-print`` " "only considers the first one." -msgstr "" +msgstr "如果目前 C frame 對應多個 Python frame,則 ``py-print`` 僅考慮第一個。" #: ../../howto/gdb_helpers.rst:360 msgid "``py-locals``" -msgstr "" +msgstr "``py-locals``" #: ../../howto/gdb_helpers.rst:362 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 frame 內的所有 Python 局部變" +"數,並列印它們的表示: ::" #: ../../howto/gdb_helpers.rst:370 msgid "" "If the current C frame corresponds to multiple Python frames, locals from " "all of them will be shown::" msgstr "" +"如果目前 C frame 對應於多個 Python frame,則會顯示所有這些 frame 的局部變數:" #: ../../howto/gdb_helpers.rst:390 msgid "Use with GDB commands" -msgstr "" +msgstr "與 GDB 指令一起使用" #: ../../howto/gdb_helpers.rst:392 msgid "" @@ -381,12 +447,16 @@ msgid "" "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 編號" +"和 ``frame`` 命令來轉到所選執行緒中的特定 frame ,如下所示: ::" #: ../../howto/gdb_helpers.rst:411 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:419 msgid "" @@ -394,3 +464,6 @@ msgid "" "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 層級正在做" +"什麼: ::"