编译Qt应用程序以获得更好的调试信息(Linux)

Compiling a Qt application in order to get better debuginfos (Linux)

本文关键字:信息 调试 Linux 更好 应用程序 Qt 编译      更新时间:2023-10-16

我下载了FabariaGest源代码,然后要编译它,你必须运行:

在qt 4系统上:

cmake -DMAKE_INSTALL_PREFIX=directory -DWANT_QT4=ON -DWANT_QWT=ON

在qt5系统上:

cmake -DMAKE_INSTALL_PREFIX=directory -DWANT_QT5=ON -DWANT_QWTQT5=ON

当它完成时,你运行

# make install

当我启动软件时,我得到一个分段错误,我试图运行

cd /opt/fabaria_gest
gdb fabaria_gest
run
backtrace

但是我只得到

[user@localhost fabaria_gest]$ gdb fabaria_gest
GNU gdb (GDB) Fedora 7.9.1-19.fc22
Copyright (C) 2015 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-redhat-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 fabaria_gest...(no debugging symbols found)...done.
(gdb) run
Starting program: /opt/fabaria_gest/fabaria_gest 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after fork from child process 7246.
[New Thread 0x7fffe0798700 (LWP 7244)]
Program received signal SIGSEGV, Segmentation fault.
0x00000000004f568c in QBasicAtomicInteger<int>::load() const ()
(gdb) backtrace
#0  0x00000000004f568c in QBasicAtomicInteger<int>::load() const ()
#1  0x0000000000502a92 in QtPrivate::RefCount::ref() ()
#2  0x0000000000502e37 in QString::QString(QString const&) ()
#3  0x00000000006b9709 in _ZL13getSystemInfov ()
#4  0x00000000006bc29f in main ()
(gdb) 
#0  0x00

为了获得更好的调试信息,我能做些什么来重新编译软件?在GDB中设置set follow-fork-mode没有帮助

使用

cmake -DCMAKE_BUILD_TYPE=Debug ...

将指示cmake生成调试信息,这应该使反向跟踪更容易阅读。