自己在除錯的時候,簡單的使用方法,目前只是菜鳥水平,後面繼續學習
資料使應用崩潰可以生成core檔案
ulimit -c unlimited
gdb 應用名稱 ***.core
程式崩潰,bt檢視堆疊資訊
switching to thread 1 (lwp 687)]
#0 kill (pid=, sig=6) at src/signal/kill.c:7
7 src/signal/kill.c: no such file or directory.
(gdb) bt
#0 kill (pid=, sig=6) at src/signal/kill.c:7
#1 #2 congruent_aligned32 () at src/string/arm/memcpy_le.s:149
#3 0xb6dddb7c in fb_fliphwsu***ce () from /usr/lib/libminigui_ths-3.2.so.0
#4 0x0012c000 in ?? ()
backtrace stopped: previous frame identical to this frame (corrupt stack?)
info threads 檢視幾個執行緒前面的數字是執行緒id
檢視有幾個執行緒,並且資訊會標識出在哪個執行緒死掉
(gdb) info thread
id target id frame
29 lwp 1005 __munmap (start=0xb66d3000, len=2457600)
at src/mman/munmap.c:12
28 lwp 757 __cp_end () at src/thread/arm/syscall_cp.s:25
27 lwp 1269 __cp_begin () at src/thread/arm/syscall_cp.s:23
26 lwp 1267 __cp_begin () at src/thread/arm/syscall_cp.s:23
25 lwp 1265 __cp_begin () at src/thread/arm/syscall_cp.s:23
24 lwp 1049 __cp_begin () at src/thread/arm/syscall_cp.s:23
23 lwp 1047 __cp_begin () at src/thread/arm/syscall_cp.s:23
22 lwp 1045 __cp_begin () at src/thread/arm/syscall_cp.s:23
21 lwp 1043 __cp_begin () at src/thread/arm/syscall_cp.s:23
20 lwp 1041 __cp_begin () at src/thread/arm/syscall_cp.s:23
19 lwp 1039 __cp_begin () at src/thread/arm/syscall_cp.s:23
18 lwp 1037 __cp_begin () at src/thread/arm/syscall_cp.s:23
17 lwp 1035 __cp_begin () at src/thread/arm/syscall_cp.s:23
16 lwp 1033 __cp_begin () at src/thread/arm/syscall_cp.s:23
15 lwp 1031 __cp_begin () at src/thread/arm/syscall_cp.s:23
14 lwp 1029 __cp_begin () at src/thread/arm/syscall_cp.s:23
13 lwp 1027 __cp_begin () at src/thread/arm/syscall_cp.s:23
12 lwp 1025 __cp_begin () at src/thread/arm/syscall_cp.s:23
11 lwp 1023 __cp_begin () at src/thread/arm/syscall_cp.s:23
10 lwp 1021 __cp_begin () at src/thread/arm/syscall_cp.s:23
9 lwp 1019 __cp_begin () at src/thread/arm/syscall_cp.s:23
---type to continue, or q to quit---
8 lwp 1017 __cp_begin () at src/thread/arm/syscall_cp.s:23
7 lwp 1015 __cp_begin () at src/thread/arm/syscall_cp.s:23
6 lwp 1013 __cp_begin () at src/thread/arm/syscall_cp.s:23
5 lwp 1011 __cp_begin () at src/thread/arm/syscall_cp.s:23
4 lwp 755 __cp_begin () at src/thread/arm/syscall_cp.s:23
3 lwp 754 __cp_begin () at src/thread/arm/syscall_cp.s:23
2 lwp 753 __cp_begin () at src/thread/arm/syscall_cp.s:23
1 lwp 687 kill (pid=, sig=6)
at src/signal/kill.c:7
可以看到我們bt看到的崩潰資訊是執行緒1的資訊
跳轉到29執行緒
bt 檢視29執行緒的堆疊
(gdb) thread 29
[switching to thread 29 (lwp 1005)]
#0 __munmap (start=0xb66d3000, len=2457600) at src/mman/munmap.c:12
12 src/mman/munmap.c: no such file or directory.
(gdb) bt
#0 __munmap (start=0xb66d3000, len=2457600) at src/mman/munmap.c:12
#1 0xb6dddc48 in fb_doublebufferenable ()
from /usr/lib/libminigui_ths-3.2.so.0
#2 0x000283b8 in cvtedoublebufferenable ()
#3 0x000174a4 in customswitchproc ()
#4 0xb6d8a724 in updatewindow () from /usr/lib/libminigui_ths-3.2.so.0
#5 0x00031f04 in cvtesettingswifiswitchproc ()
#6 0x00017414 in customswitchproc ()
#7 0xb6da5a94 in dispatchmessage () from /usr/lib/libminigui_ths-3.2.so.0
#8 0x00029710 in cvtesettingsthread ()
#9 0xb6f5ffdc in start (p=0xb5ce3d2c) at src/thread/pthread_create.c:145
從上面的資訊可以看出,29執行緒正常執行,然後呼叫到fb_doublebufferenable->fb_fliphwsu***ce觸發主線程/也就是1號執行緒死掉,整個應用死掉 GDB除錯core檔案
1.什麼是core dump?core dump說的是作業系統執行的乙個動作,當某個程序因為一些原因意外終止 crash 的時候,作業系統會將這個程序當時的記憶體資訊轉儲 dump 到磁碟上,產生的檔案就是core檔案了,一般會以core.形式命名。2.那些訊號能夠引起core dump?經常用到的...
GDB除錯coredump檔案
linux上程式崩潰起來挺煩人,不過linux 比較好的是有gdb.echo ulimit c unlimited etc profile 然後記得敲入命令 source etc profile然後敲入命令 ulimit c效果如下 確認能否生成coredump檔案,使用如下命令 使用時注意,我在測...
gdb除錯coredump檔案
linux上程式崩潰起來挺煩人,不過linux 比較好的是有gdb.echo ulimit c unlimited etc profile 然後記得敲入命令 source etc profile然後敲入命令 ulimit c效果如下 確認能否生成coredump檔案,使用如下命令 使用時注意,我在測...