当 运行 gdb 得到 python 异常时

when running gdb get python exceptions

当我尝试 运行 gdb 时,我看到以下 python 异常。 想知道 1. 这些 python 异常是什么意思 2. 它是否会影响 gdb 调试或 bt 分析。 3.如何解决这些错误。

Traceback (most recent call last):
  File "/usr/share/gdb/python/gdb/__init__.py", line 144, in auto_load_packages
    __import__(modname)
  File "/usr/share/gdb/python/gdb/function/strfns.py", line 105, in <module>
    _MemEq()
  File "/usr/share/gdb/python/gdb/function/strfns.py", line 33, in __init__
    super(_MemEq, self).__init__("_memeq")
LookupError: no codec search functions registered: can't find encoding

Python Exception <type 'exceptions.LookupError'> no codec search functions registered: can't find encoding:
Python Exception <type 'exceptions.LookupError'> no codec search functions registered: can't find encoding:
Python Exception <type 'exceptions.LookupError'> no codec search functions registered: can't find encoding:
Traceback (most recent call last):
  File "/usr/share/gdb/python/gdb/__init__.py", line 144, in auto_load_packages
    __import__(modname)
  File "/usr/share/gdb/python/gdb/command/prompt.py", line 65, in <module>
    _ExtendedPrompt()
  File "/usr/share/gdb/python/gdb/command/prompt.py", line 44, in __init__
    self.value = ''
LookupError: no codec search functions registered: can't find encoding


GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-none-linux-gnueabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...

what these python exceptions mean

GDB(当使用 --enable-python(默认)编译时)加载某些内置的嵌入式 Python 脚本。此加载失败,因为未执行 GDB make install,或者(此处更可能)Python 安装不完整。

will it impact anyway in gdb debugging or bt analysis.

是的:GDB 依赖于许多嵌入式 Python 功能,您可能会在几乎每个命令中遇到这些异常。

How to resolve these errors.

确保您已将 GDB 和 Python 的完整安装(包括 data 子目录和 .pyc 文件)复制到您所在的系统 运行 GDB.

或者,使用 --disable-python 配置 GDB 也应该清除这些错误。