首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当"( gdb )步骤“时在gdb中获取python exeception

当"( gdb )步骤“时在gdb中获取python exeception
EN

Stack Overflow用户
提问于 2021-04-05 04:27:41
回答 1查看 508关注 0票数 1

当我执行代码行时,我会得到python异常。我想要的是进入或超越,但是当我键入(gdb) step并抛出异常时,我就会得到这个异常。我用-g标志编译了代码。抛出此异常

Python 安装错误: gdb._execute_unwinders函数丢失:线程3 "s1.o“命中断点2,get_payload_to_send (Python 安装错误: gdb._execute_unwinders函数丢失: p=0x55555555a2c0,pay=0x7ffff75bfe78)在ServerHi1.c:679警告:源文件比可执行文件更近期。焦炭c20 6 79份;(gdb)步骤Python 安装错误: gdb._execute_unwinders函数丢失: Python 安装错误: Python 安装错误: gdb._execute_unwinders函数丢失: Python 安装错误: gdb._execute_unwinders函数丢失:__inet_addr (Python 安装错误: 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

EN

回答 1

Stack Overflow用户

发布于 2021-11-24 20:24:14

我从源代码中安装了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

附加:将gcc 11.1从Debian 10源代码中安装为gdb111而不是gdb的完整步骤(即不覆盖系统gdb):

代码语言:javascript
复制
apt update &&
apt install texinfo subversion 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 -j `nproc` &&
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/

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

如果没有像这样从源代码安装,则可以使用sudo apt install --reinstall gdb重新安装/恢复gdb安装。

更新

在Dockerfile菜谱中,您需要在单独的步骤中运行perl:

代码语言:javascript
复制
RUN perl -pi -e '!$x && s/function black b;/function b;/i && ($x=1)' /usr/share/source-highlight/esc.style
RUN svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python /root/gdb_stl_python \
    && printf 'python \nimport sys \nsys.path.insert(0, "/root/gdb_stl_python") \nfrom libstdcxx.v6.printers import register_libstdcxx_printers \nregister_libstdcxx_printers (None) \nend \n' >> /root/.gdbinit

参考文献:

  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 -在GNOME终端“黑暗”主题

上,新的gdb终端颜色不可读

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66948246

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档