2015-10-18 43 views
0

我下載FabariaGest source code然後編譯它,你必須運行:編譯Qt應用程序,以獲得更好的debuginfos(Linux)的

對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 

,但我只得到

[[email protected] 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 

我能做些什麼,以獲得更好的debuginfos重新編譯軟件?在GDB設置set follow-fork-mode沒有幫助

+0

在您的構建目錄(應運行構建版本)而不是'gdb fabaria_gest'(應該運行安裝的版本)中嘗試'gdb。/ fabaria_gest'。從調試符號剝離是「安裝」目標的常用部分。 – jbm

+2

'cmake -DCMAKE_BUILD_TYPE = Debug ...'也可能有所幫助,但是之後它已經顯示了函數名稱,並且應該很容易推斷出該函數中的哪一行失敗。 –

+0

@MattiVirkkunen你可以填寫一個答案,所以我可以給你的綠色標誌? –

回答

1

使用

cmake -DCMAKE_BUILD_TYPE=Debug ... 

將指示cmake的生成調試信息,這將使回溯更易於閱讀。

+0

爲了生成調試信息(希望沒有改變codegen),你應該使用'RelWithDebInfo';使用'Debug'禁用優化並啓用幾個調試幫助,這可能會使常規錯誤更加明顯,但可能會隱藏只在發佈版本中發生的heisenbug。 –

+0

我想說如果你可以重現這個bug,首先嚐試使用普通的'Debug',因爲你可能會得到更好的回溯。但是,如果這是在啓用調試時會消失的錯誤之一,那麼很好。 –

+0

當然,這就是爲什麼我upvoted你的答案。 :) –