我正在尝试从GCC学习不同的编译阶段。 手动逐级编译 并完全用“g ++ only”再次编译 在末尾 main.as.o与main.gcc.o相同,没有调试信息 但 main.as.debug.o与main.gcc.debug.o非常不同 为什么? ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
从这个链接: http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
-dH 在发生错误时生成核心转储。
所以,我编译了一个语法错误的程序,并生成了核心文件。 现在如何使用该核心文件? 由于尚未生成任何可执行文件,因此无法调用 GDB。
[11:11:12 Wed Apr 27]
~/junk1 $ls
core hell.c
[11:11:15 Wed Apr 27]
~/junk1 $gcc -g hell.c -dH
hell.c: In function ‘main’:
hell.c:4: error: expected ‘;’ before ‘}’ token
gcc: Internal error: Aborted (program cc1)
Please submit a full bug report.
See <http://bugs.opensuse.org/> for instructions.
[11:11:36 Wed Apr 27]
~/junk1 $ls
core hell.c
[11:12:09 Wed Apr 27]
~/junk1 $gdb cc1 core
GNU gdb (GDB) SUSE (6.8.91.20090930-2.4)
Copyright (C) 2009 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-suse-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
***cc1: No such file or directory.***
Missing separate debuginfo for the main executable file
Try: zypper install -C "debuginfo(build-id)=41f1efcceccfa5fa0b3476021c731c489547f86e"
Core was generated by `/usr/lib64/gcc/x86_64-suse-linux/4.4/cc1 -quiet hell.c -quiet -dumpbase hell.c'.
Program terminated with signal 6, Aborted.
#0 0x00007fb1b01654e5 in ?? ()
(gdb)
GDB 说:cc1: No such file or directory,在上面的output中。 我应该如何使用该核心文件?
我认为这个开关是为了帮助调试gcc ,而不是你的程序。 您链接到的页面如下所示:
3.9 调试程序或 GCC的选项
GCC 具有各种特殊选项,用于调试您的程序或 GCC :
强调我的。
cc1
程序是 GCC 的内部部分,它可能位于/usr/lib/
或/usr/libexec/
下的某个位置。
gdb -c corefile
应该可以工作。 我不必使用-dH
选项,所以不确定它在帮助调试方面有多大用处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.