Add translations to dev-tools gcov

Signed-off-by: Bernard Zhao <bern...@vivo.com>
Reviewed-by: Wu X.C <bob...@email.cn>
---
Changes since V1:
* add index.rst in dev-tools and link to to zh_CN/index.rst
* fix some inaccurate translation

Link for V1:
*https://lore.kernel.org/patchwork/patch/1405740/
---
 .../translations/zh_CN/dev-tools/gcov.rst     | 279 ++++++++++++++++++
 .../translations/zh_CN/dev-tools/index.rst    |  39 +++
 Documentation/translations/zh_CN/index.rst    |   1 +
 3 files changed, 319 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/dev-tools/gcov.rst
 create mode 100644 Documentation/translations/zh_CN/dev-tools/index.rst

diff --git a/Documentation/translations/zh_CN/dev-tools/gcov.rst 
b/Documentation/translations/zh_CN/dev-tools/gcov.rst
new file mode 100644
index 000000000000..e8ffb99b566d
--- /dev/null
+++ b/Documentation/translations/zh_CN/dev-tools/gcov.rst
@@ -0,0 +1,279 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :ref:`Documentation/dev-tools/gcov.rst <dev-tools_gcov>`
+:Translator: ????????? Bernard Zhao <bern...@vivo.com>
+
+.. _dev-tools_gcov:
+
+???Linux???????????????gcov????????????????????????
+====================================
+
+gcov???linux????????????????????????????????????,????????????????????????
+GCC???????????????????????????????????????.
+linux?????????????????????????????????????????????gcov?????????????????????
+???debug-fs???,????????????gcov??????-o?????????????????????????????????
+???????????????????????????????????????????????????????????????????????????
+????????????????????????root?????????::
+
+    # cd /tmp/linux-out
+    # gcov -o /sys/kernel/debug/gcov/tmp/linux-out/kernel spinlock.c
+
+????????????????????????????????????????????????????????????????????????.
+??????????????????????????????,????????????????????????gcov[1]?????????
+????????????lcov[2]???,????????????????????????linux ????????????
+??????????????????,???????????????????????????HTML????????????.
+
+???????????????:
+
+* ???????????????????????????????????????????????????????????????
+* ???????????????????????????????????????,??????????????????????????????
+  ??????????????????
+* ????????????????????????????????????????????????,?????????????????????
+  ?????????????????????,??????????????????????????????
+
+[1]_gcov: https://gcc.gnu.org/onlinedocs/gcc/Gcov.html
+[2]_lcov: http://ltp.sourceforge.net/coverage/lcov.php
+
+
+??????
+-----------
+
+????????????????????????::
+
+        CONFIG_DEBUG_FS=y
+        CONFIG_GCOV_KERNEL=y
+
+????????????????????????????????????,???????????????::
+
+        CONFIG_GCOV_PROFILE_ALL=y
+
+??????????????????,??????????????????????????????????????????????????????
+?????????????????????,???????????????????????????????????????.
+??????,??????????????????????????????????????????????????????????????????
+
+?????????????????????????????????debugfs??????????????????????????????::
+
+        mount -t debugfs none /sys/kernel/debug
+
+
+?????????
+-------------
+
+???????????????????????????????????????????????????????????????????????????
+??????????????????????????????Makefile????????????????????????:
+
+- ?????????????????????????????????main.o???::
+
+    GCOV_PROFILE_main.o := y
+
+- ???????????????????????????::
+
+    GCOV_PROFILE := y
+
+?????????????????????????????????????????????CONFIG_GCOV_PROFILE_ALL???
+??????????????????????????????????????????,???????????????????????????::
+
+    GCOV_PROFILE_main.o := n
+
+???::
+
+    GCOV_PROFILE := n
+
+????????????????????????????????????????????????????????????????????????.
+
+
+????????????
+-------------
+
+gcov???????????????debugfs?????????????????????:
+
+``/sys/kernel/debug/gcov``
+    gcov????????????????????????
+
+``/sys/kernel/debug/gcov/reset``
+    ??????????????????:??????????????????????????????????????????gcov??????
+    ?????????0
+
+``/sys/kernel/debug/gcov/path/to/compile/dir/file.gcda``
+    gcov????????????????????????????????????????????????,??????????????????
+    ???????????????????????????gcov???????????????0
+
+``/sys/kernel/debug/gcov/path/to/compile/dir/file.gcno``
+    gcov??????????????????????????????????????????????????????????????????
+    ????????????,??????????????????gcc??????????????????????????????
+    ???-ftest-coverage???????????????.
+
+
+?????????????????????
+-------
+
+?????????????????????????????????????????????,????????????????????????
+?????????????????????.
+gcov?????????????????????,??????????????????????????????????????????
+???????????????????????????????????????.
+????????????????????????????????????debugfs??????????????????.
+??????????????????????????????,???????????????????????????????????????
+??????debugfs??????????????????.
+
+???????????????????????????gcov_persist??????????????????gcov
+????????????????????????::
+
+        gcov_persist = 0
+
+????????????,????????????????????????????????????????????????????????????
+gcov?????????????????????????????????????????????.
+
+
+??????????????????????????????
+---------------------------------
+
+gcov??????????????????????????????????????????????????????????????????
+?????????,????????????????????????????????????????????????.
+?????????????????????????????????????????????,???????????????????????????
+??????,????????????gcov???????????????????????????:
+
+a) ???gcov????????????????????????
+
+    ??????????????????gcov??????????????????????????????????????????
+    ????????????gcc???????????????,?????????????????????????????????
+    ??????????????????????????????:
+
+    ???????????????:
+      - ?????????C??????????????????
+
+    ??????????????????:
+      - ?????????C??????????????????
+      - ?????????.gcda?????????.gcno??????
+      - ?????????????????????
+
+    ??????????????????,????????????????????????????????????????????????
+    ???????????????????????????????????????.
+    ????????????????????????,????????????????????????????????????
+   ????????????make???????????????????????????CURDIR????????????
+
+b) ???gcov????????????????????????
+
+    ???????????????????????????,???????????????????????????????????????
+    ????????????????????????:
+
+    ???sysfs??????gcov?????????:
+      - ?????????.gcda??????
+      - ?????????.gcno???????????????
+
+    ?????????????????????????????????????????????????????????,gcov???
+    ???-o???????????????????????????.
+
+    ??????????????????????????????????????????::
+
+      /tmp/linux:    ??????????????????
+      /tmp/out:      ???????????????????????????make O=?????????
+      /tmp/coverage: ????????????????????????????????????????????????
+
+      [user@build] cd /tmp/out
+      [user@build] gcov -o /tmp/coverage/tmp/out/init main.c
+
+
+??????????????????????????????
+-----------------
+
+GCC???LLVM gcov?????????????????????.
+??????????????????GCC,??????gcov_[3]?????????.gcno???.gcda??????
+?????????Clang?????????,?????????llvm-cov_[4].
+
+[3]_gcov: https://gcc.gnu.org/onlinedocs/gcc/Gcov.html
+[4]_llvm-cov: https://llvm.org/docs/CommandGuide/llvm-cov.html
+
+GCC???Clang gcov????????????????????????Kconfig?????????.
+kconfig??????????????????????????????????????????????????????gcov??????.
+
+????????????
+---------------
+
+?????????????????????1
+    ?????????????????????????????????
+
+????????????
+    ???????????????????????????????????????????????????????????????
+    ??????????????????????????????
+
+????????????
+    ??????????????????Makefile????????????GCOV_PROFILE := n???
+    ?????????GCOV_PROFILE_basename.o := n??????????????????????????????
+    ?????????
+
+?????????????????????2
+    ???sysfs???????????????????????????????????????
+
+????????????
+    ??????seq_file???????????????,?????????????????????cp???tar???
+    ????????????????????????sysfs????????????.
+
+????????????
+    ?????????cat????????????.gcda?????????,?????????cp -d???????????????
+    ??????????????????B??????????????????.
+
+
+??????A::collect_on_build.sh
+------------------------------
+
+???????????????????????????????????????????????????????????????
+???????????????
+?????????6a?????????
+
+.. code-block:: sh
+
+    #!/bin/bash
+
+    KSRC=$1
+    KOBJ=$2
+    DEST=$3
+
+    if [ -z "$KSRC" ] || [ -z "$KOBJ" ] || [ -z "$DEST" ]; then
+      echo "Usage: $0 <ksrc directory> <kobj directory> <output.tar.gz>" >&2
+      exit 1
+    fi
+
+    KSRC=$(cd $KSRC; printf "all:\n\t@echo \${CURDIR}\n" | make -f -)
+    KOBJ=$(cd $KOBJ; printf "all:\n\t@echo \${CURDIR}\n" | make -f -)
+
+    find $KSRC $KOBJ \( -name '*.gcno' -o -name '*.[ch]' -o -type l \) -a \
+                     -perm /u+r,g+r | tar cfz $DEST -P -T -
+
+    if [ $? -eq 0 ] ; then
+      echo "$DEST successfully created, copy to test system and unpack with:"
+      echo "  tar xfz $DEST -P"
+    else
+      echo "Could not create file $DEST"
+    fi
+
+
+??????B::collect_on_test.sh
+-----------------------------
+
+??????????????????????????????????????????????????????????????????????????????
+?????????6b?????????
+
+.. code-block:: sh
+
+    #!/bin/bash -e
+
+    DEST=$1
+    GCDA=/sys/kernel/debug/gcov
+
+    if [ -z "$DEST" ] ; then
+      echo "Usage: $0 <output.tar.gz>" >&2
+      exit 1
+    fi
+
+    TEMPDIR=$(mktemp -d)
+    echo Collecting data..
+    find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \;
+    find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \;
+    find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \;
+    tar czf $DEST -C $TEMPDIR sys
+    rm -rf $TEMPDIR
+
+    echo "$DEST successfully created, copy to build system and unpack with:"
+    echo "  tar xfz $DEST"
diff --git a/Documentation/translations/zh_CN/dev-tools/index.rst 
b/Documentation/translations/zh_CN/dev-tools/index.rst
new file mode 100644
index 000000000000..0c6b5c2f4a7f
--- /dev/null
+++ b/Documentation/translations/zh_CN/dev-tools/index.rst
@@ -0,0 +1,39 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :ref:`Documentation/dev-tools/gcov.rst 
<development_dev-tools_index>`
+:Translator: ????????? Bernard Zhao <bern...@vivo.com>
+
+.. _development_dev-tools_index:
+
+================================
+??????????????????
+================================
+
+??????????????????????????????????????????????????????
+??????????????????????????????????????????????????????????????????????????????
+?????????????????????
+
+.. class:: toc-title
+
+   ??????
+
+.. toctree::
+   :maxdepth: 2
+
+   gcov
+
+Todolist:
+
+   coccinelle
+   sparse
+   kcov
+   kasan
+   ubsan
+   kmemleak
+   kcsan
+   gdb-kernel-debugging
+   kgdb
+   kselftest
+   kunit/index
diff --git a/Documentation/translations/zh_CN/index.rst 
b/Documentation/translations/zh_CN/index.rst
index be6f11176200..a5e483b0c7f2 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -20,6 +20,7 @@
    process/index
    filesystems/index
    arm64/index
+   dev-tools/index
 
 ???????????????
 ----------
-- 
2.31.0

Reply via email to