【发布时间】:2014-06-03 20:14:32
【问题描述】:
当尝试使用程序运行 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(调试标志)编译时发生。这是二进制文件大小的差异:
编译
-release flag: 405 MB
-debug flag: 862 MB
对造成这种分段错误的其他罪魁祸首有什么想法吗?或者有没有办法增加gdb允许的内存?这对谷歌来说是一个非常具有挑战性的问题。
【问题讨论】:
-
旁注:一些办公室同事建议在 gdb 上使用 gdb 的解决方案(这甚至可能吗? - 似乎不起作用)或尝试 lldb 代替(现在研究这个)。跨度>
-
你用的是什么编译器?您是否尝试过另一个 gdb 安装?
-
英特尔/composer_xe_2013_sp1。不,您的意思是重新安装 gdb,还是安装其他版本?我可以试试。
-
是的,或者在另一台机器上尝试 gdb ?
-
我会尝试重新安装 gdb,该程序需要 4 个多小时才能编译,而且我没有在另一台机器上编译的调试版本。我也会开始做,但需要一段时间。