當把程式安裝至ubuntu的開機啟動項後,發現程式崩潰無法啟動且非必現,可通過如下操作進行解析.
2.如有崩潰內容,將會把崩潰日誌寫入/var/crash/中,且名稱為崩潰內容如:
/var/crash/_opt_ros_kinetic_lib_test.0.crash
系統除錯有兩種方法,第一種為設定core大小,隨後執行程式,產出崩潰核心,使用gdb 程式 core形式進行分析
第二種為解壓系統產出的.crash,使用解壓出來的coredump檔案進行gdb除錯,目標現場較多
1.將.crash解壓縮至其他目錄
2.使用gdb對解壓縮出來的coredump進行分析
首先建立問題目錄,如~/corefile
mkdir ~/coredir
將.crash解壓至coredir
完成後,將會在~/coredir中產生:
-rw-r--r-- 1 root whoopsie 5 5月 18 13:44 architecture
-rw-r--r-- 1 root whoopsie 227246080 5月 18 13:44 coredump
-rw-r--r-- 1 root whoopsie 24 5月 18 13:44 date
-rw-r--r-- 1 root whoopsie 12 5月 18 13:44 distrorelease
-rw-r--r-- 1 root whoopsie 77 5月 18 13:44 executablepath
-rw-r--r-- 1 root whoopsie 10 5月 18 13:44 executabletimestamp
-rw-r--r-- 1 root whoopsie 5 5月 18 13:44 problemtype
-rw-r--r-- 1 root whoopsie 346 5月 18 13:44 proccmdline
-rw-r--r-- 1 root whoopsie 10 5月 18 13:44 proccwd
-rw-r--r-- 1 root whoopsie 317 5月 18 13:44 procenviron
-rw-r--r-- 1 root whoopsie 30607 5月 18 13:44 procmaps
-rw-r--r-- 1 root whoopsie 1308 5月 18 13:44 procstatus
-rw-r--r-- 1 root whoopsie 2 5月 18 13:44 signal
-rw-r--r-- 1 root whoopsie 30 5月 18 13:44 uname
其中coredump為core日誌.
解壓來可使用gdb進行除錯,如
gdb /opt/ros/kinetic/lib/test/test ~/coredir/coredump
其中/opr/ros/kinetic/lib/test/test為可執行程式, ~/coredir/coredump為解壓.crash後產生的檔案,進入gdb後執行bt,可檢視崩潰位址
gdb /opt/ros/kinetic/lib/test/test ~/coredir/coredump
gnu gdb (ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
license gplv3+: gnu gpl version 3 or later 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:
.find the gdb manual and other documentation resources online at:
.for help, type "help".
type "apropos word" to search for commands related to "word"...
reading symbols from /opt/ros/kinetic/lib/test/test...(no debugging symbols found)...done.
warning: core file may not match specified executable file.
[new lwp 10383]
[thread debugging using libthread_db enabled]
using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
bcore was generated by `/opt/ros/kinetic/lib/test/test f'.
program terminated with signal sigse**, segmentation fault.
#0 _io_new_proc_open (fp=fp@entry=0x7f45740008f0, command=command@entry=0x7f4574000b10 "cat /proc/meminfo", mode=, mode@entry=0x7f45bc9895b1 "r") at iopopen.c:213
213 iopopen.c: no such file or directory.
(gdb) bt
#0 _io_new_proc_open (fp=fp@entry=0x7f45740008f0, command=command@entry=0x7f4574000b10 "cat /proc/meminfo", mode=, mode@entry=0x7f45bc9895b1 "r") at iopopen.c:213
#1 0x00007f45bd14d65c in _io_new_popen (command=0x7f4574000b10 "cat /proc/meminfo", mode=0x7f45bc9895b1 "r") at iopopen.c:296
#2 0x00007f45bc971607 in geekplus::rsm::exec(std::__cxx11::basic_string, std::allocator> const&) () from /opt/ros/kinetic/lib/libgeekplusbot_rsm_common.so
#3 0x00007f45bf4293a9 in * () from /opt/ros/kinetic/lib/libtest.so
#4 0x000000000042836f in boost::detail::thread_data>::run() ()
#5 0x00007f45be11a5d5 in ?? () from /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0
#6 0x00007f45bdceb6ba in start_thread (arg=0x7f457bfff700) at pthread_create.c:333
#7 0x00007f45bd1e541d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.s:109
(gdb) q
由日誌分析克制,在'cat /proc/meminfo'中發生崩潰.修復bug即可 Ubuntu 程式開機啟動設定
假設指令碼manager.sh,用來管理我的程序,想設定開機啟動 將指令碼拷貝到 etc init.d下面 sudo cp manager.sh etc init.d 為指令碼新增可執行許可權 sudo chmod x etc init.d manager.sh 更新系統啟動配置 cd etc in...
UBUNTU 新增開機啟動程式
1.在 etc init.d 目錄下新建指令碼檔案 jr bin sh begin init info provides binfmt support required start local fs remote fs required stop local fs remote fs default...
ubuntu開機啟動
ubuntu開機之後會執行 etc rc.local檔案中的指令碼,所以我們可以直接在 etc rc.local中新增啟動指令碼。當然要新增到語句 exit 0前面才行。比如,我希望開機啟動goagent,那麼 1.vim etc rc.local 2.在exit 0前面新增下列語句 python ...