【问题标题】:getting python exeception in gdb when "(gdb) step"当“(gdb)步骤”时在gdb中获取python异常
【发布时间】:2021-04-05 04:27:41
【问题描述】:

当我单步执行代码行时出现 python 异常。我想要的是进入或跳过,但是当我输入 (gdb) step 并且 bang 抛出异常时,我得到了这个异常。我用-g 标志编译了代码。抛出这个异常

Python Exception 安装错误:gdb._execute_unwinders 函数丢失:

Thread 3 "s1.o" hit Breakpoint 2, get_payload_to_send (Python Exception Installation error: gdb._execute_unwinders function is missing: p=0x55555555a2c0, pay=0x7ffff75bfe78) 在 ServerHi1.c:679 警告:源文件比可执行文件更新。

679 字符 c[20]; (gdb) 步骤

Python Exception 安装错误:gdb._execute_unwinders 函数丢失:

Python Exception 安装错误:gdb._execute_unwinders 函数是 缺失:

Python Exception 安装错误:gdb._execute_unwinders 函数丢失:

Python Exception 安装错误:gdb._execute_unwinders 函数丢失:

__inet_addr (Python Exception 安装错误:gdb._execute_unwinders 函数丢失: cp=0x55555555a6d2 "192.168.10.25") 在 inet_addr.c:210 210 inet_addr.c: 没有这样的文件或目录。

(gdb)

我想要的是进入/跨过单行。 C语言编码

gdb 版本:GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git

【问题讨论】:

  • 这听起来像你 gdb 安装坏了。 gdb._execute_unwinders 应该在 share/gdb/python/gdb/__init__.py 中。
  • 如何修复安装?

标签: c linux gdb


【解决方案1】:

我从源代码安装了gdb 11.1,但我遇到了同样的错误。我通过手动将python文件复制到/usr/share/gdb/python来修复,即:

  1. cd gdb-11.1
  2. make
  3. make install
  4. cp -r ./gdb/python/lib/gdb/ /usr/share/gdb/python

额外:在 Debian 10 上从源代码安装 gcc 11.1 的完整步骤为 gdb111 而不是 gdb(即,不覆盖您的系统 gdb):

apt update &&
apt install texinfo wget \
    libgmp-dev python3-dev libncurses5-dev libsource-highlight &&
wget http://ftp.gnu.org/gnu/gdb/gdb-11.1.tar.gz &&
tar xvzf gdb-11.1.tar.gz &&
cd gdb-11.1 &&
./configure --prefix=/usr/local/gdb111 \
    --program-suffix=111 --with-python=python3 \
    --enable-tui=yes --with-curses --enable-gold=yes \
    --enable-ld=yes --enable-libada --enable-libssp \
    --enable-lto --enable-vtable-verify --enable-werror \
    --enable-source-highlight &&
make &&
make install &&
rsync --recursive ./gdb/python/lib/gdb/ /usr/share/gdb/python/gdb/ &&
perl -pi -e '!$x && s/function black b;/function b;/i && ($x=1)' \
    /usr/share/source-highlight/esc.style &&
printf ‘set debug-file-directory /usr/lib/debug/\n' >> ~/.gdbinit &&
cp /usr/local/gdb111/bin/gdb111 /bin/

或者,不是手动将文件复制到系统中,而是使用参数冷运行 gdb,例如 gdb111 -p $(pidof someprocess) --data-directory /path/to/source/gdb-11.1/gdb/data-directory

如果您不是像这样从源安装,您可以使用sudo apt install --reinstall gdb 重新安装/恢复您的 gdb 安装

参考资料:

  1. https://superuser.com/questions/102449/how-to-reinstall-a-package-using-apt-get
  2. https://askubuntu.com/questions/32507/how-do-i-get-a-list-of-installed-files-from-a-package
  3. https://bugzilla.redhat.com/show_bug.cgi?id=1688372 - 新的 gdb 终端颜色在 GNOME 终端“深色”主题上不可读

【讨论】:

    猜你喜欢
    • 2011-09-11
    • 2013-05-29
    • 1970-01-01
    • 1970-01-01
    • 2013-04-25
    • 2016-06-05
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    相关资源
    最近更新 更多