gpt4 book ai didi

c++ - 读取符号时 gdb 段错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:31:11 25 4
gpt4 key购买 nike

当尝试使用程序运行 gdb 时,它会在读取符号时出现错误。

当我运行时:

gdb/home/user/path/to/program.exe

我得到:

GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 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 "x86_64-linux-gnu".
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"...
Reading symbols from /home/user/path/to/program.exe...Segmentation fault (core dumped)

我怀疑二进制文件可能太大,gdb 无法加载到内存中。此错误仅在我使用 -g(调试标志)编译时发生。这是二进制文件大小的差异:

编译为

-发布标志:405 MB

-调试标志:862 MB

关于这个段错误的其他罪魁祸首有什么想法吗?或者有没有办法增加 gdb 允许的内存?事实证明,这对谷歌来说是一个非常具有挑战性的问题。

最佳答案

我在 Ubuntu 15.04 x86_64 上遇到了与 gdb 7.9 相同的问题,我只是使用 apt-get install gdb 安装了它。

我通过编译和安装以前的版本解决了这个问题:gdb 7.5.1

我必须下载一个库(我发现了 here ),我还必须使用一些参数运行 ./configure (我发现了 here )。其他一切都很简单。

祝你好运。

命令如下:

$ cd
$ sudo apt-get install libncurses5-dev
$ wget ftp://sourceware.org/pub/gdb/releases/gdb-7.5.1.tar.gz
$ tar zxf gdb-7.5.1.tar.gz
$ cd gdb-7.5.1
$ sudo ./configure --disable-werror
$ sudo make
$ sudo make install

关于c++ - 读取符号时 gdb 段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24024143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com