python - 运行 gdb 时获取 python 异常

标签 python gdb

当我尝试运行 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 也应该清除这些错误。

关于python - 运行 gdb 时获取 python 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61475507/

相关文章:

python - 根据组的第一个日期将月份累积添加到日期列

python - Django 错误 --SyntaxError : invalid syntax

python - 在字符串中添加一个空格

gdb - 从当前目录加载.gdbinit失败,并显示“自动加载已被您的“自动加载安全路径”拒绝”

c - 内核模块没有找到调试符号

python - Pip freeze 不显示需求文件的存储库路径

python - 禁用 QDial 鼠标点击和换针

memory - GDB 中的 x86 标签和 LEA

debugging - 如何在尚未加载到 gdb 的共享库中的函数上设置断点

c - gdb: "No symbol table is loaded"