linux下调试程序学习笔记二

在上节的内容中简单的描述了下如果用gdb来看崩溃的程序,这一节进行动态库相关崩溃问题的定位

以一个软件为例子,已经设置了生成core文件。在软件运行中形成了 一个core文件

1.到core文件目录,然后执行 对应的core文件分析指令如下

[root@localhost Core]# gdb /home/root/puc/Server/Business core-Business-11-4786-1601178659
具体的格式就是  gdb 加上可执行文件 dump文件

输出如下:

GNU gdb (GDB) 7.5
Copyright (C) 2012 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-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/root/puc/Server/Business...done.
[New LWP 5272]
[New LWP 5274]
[New LWP 5277]
[New LWP 5276]
[New LWP 5275]
[New LWP 5278]
[New LWP 5343]
[New LWP 5341]
[New LWP 5326]
[New LWP 5345]
[New LWP 5352]
[New LWP 5338]
[New LWP 5351]
[New LWP 5353]
[New LWP 5346]
[New LWP 5371]
[New LWP 5365]
[New LWP 5528]
[New LWP 5479]
[New LWP 5367]
[New LWP 5543]
[New LWP 5480]
[New LWP 5783]
[New LWP 5586]
[New LWP 5787]
[New LWP 5592]
[New LWP 5788]
[New LWP 5780]
[New LWP 5269]
[New LWP 5270]
[New LWP 5271]

warning: Can't read pathname for load map: 输入/输出错误.

warning: Could not load shared library symbols for 36 libraries, e.g. Plugin/Business/PackerServer.plg.
Use the "info sharedlibrary" command to see the complete listing.

Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".
 

然而这个提示说我们加载动态失败了,那么我们就按他的提示,看看是否有失败的

info sharedlibrary
 

                                        No          Plugin/Business/RoleManager.plg
                                        No          Plugin/Business/FavoriteManager.plg
                                        No          Plugin/Business/SysPatchManager.plg
                                        No          Plugin/Business/ConferenceMa---Type <return> to continue, or q <return> to quit---
nager.plg
                                        No          Plugin/Business/EmergencyAlarmPlugin.plg
                                        No          Plugin/Business/MonitorManagerPlugin.plg
                                        No          Plugin/Business/SecurityServicePlugin.plg
                                        No          Plugin/Business/CostomSAPBackup.plg
                                        No          Plugin/Business/CallRouteManagerPlugin.plg
0x00007f3a4909fb40  0x00007f3a4909ffc0  Yes (*)     /home/root/puc/Server/libpcre2-posix.so.1
0x00007f3a48e56b60  0x00007f3a48e83f54  Yes (*)     /home/root/puc/Server/libpcre2-8.so.0
                                        No          Plugin/Business/GPSManagerPlugin.plg
                                        No          Plugin/Business/ReportQueryPlugin.plg
                                        No          Plugin/Business/CallbackPlugin.plg
                                        No          Plugin/Business/POIManager.plg
---Type <return> to continue, or q <return> to quit---
                                        No          Plugin/Business/FtpMgrServer.plg
0x00007f3a447f63a0  0x00007f3a44806520  Yes         /home/root/puc/Server/libFTPClientLib.so
                                        No          Plugin/Business/SDSServer.plg
                                        No          Plugin/Business/DgnaPlugin.plg
                                        No          Plugin/Business/RRSServer.plg
                                        No          Plugin/Business/ServerCCManager.plg
我们看有很多插件是no的状态,就是没有加载上来。

然后重新加载下插件库:

(gdb) set solib-search-path /home/root/puc/Server/Plugin/Business/
Reading symbols from /home/root/puc/Server/Plugin/Business/PackerServer.plg...done.
Loaded symbols for /home/root/puc/Server/Plugin/Business/PackerServer.plg
Reading symbols from /home/root/puc/Server/Plugin/Business/MutilLevelDispatchPlugin.plg...done.
Loaded symbols for /home/root/puc/Server/Plugin/Business/MutilLevelDispatchPlugin.plg
Reading symbols from /home/root/puc/Server/Plugin/Business/ConfigServer.plg...done.
Loaded symbols for /home/root/puc/Server/Plugin/Business/ConfigServer.plg
Reading symbols from /home/root/puc/Server/Plugin/Business/LoggerServer.plg...done.
Loaded symbols for /home/root/puc/Server/Plugin/Business/LoggerServer.plg
Reading symbols from /home/root/puc/Server/Plugin/Business/ServiceStatus.plg...done.
Loaded symbols for /home/root/puc/Server/Plugin/Business/ServiceStatus.plg
Reading symbols from /home/root/puc/Server/Plugin/Business/StatusMonitorPlugin.plg...done.
Loaded symbols for /home/root/puc/Server/Plugin/Business/StatusMonitorPlugin.plg
Reading symbols from /home/root/puc/Server/Plugin/Business/DataCenter.plg...done.
加载完成以后,查看堆栈信息

(gdb) bt
#0  0x00007f3a60122cb8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) () from /lib64/libstdc++.so.6
#1  0x00007f3a4263a7f4 in std::pair<std::string const, std::vector<PUC::RRSClientRadioStatusInfo, std::allocator<PUC::RRSClientRadioStatusInfo> > >::pair (this=0x7f3a3a21d6e0, __a=..., __b=...)
    at /usr/include/c++/4.8.2/bits/stl_pair.h:113
#2  0x00007f3a4263209e in std::map<std::string, std::vector<PUC::RRSClientRadioStatusInfo, std::allocator<PUC::RRSClientRadioStatusInfo> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<PUC::RRSClientRadioStatusInfo, std::allocator<PUC::RRSClientRadioStatusInfo> > > > >::operator[] (this=0x7f3a3a21d780, __k=...) at /usr/include/c++/4.8.2/bits/stl_map.h:469
#3  0x00007f3a425f0072 in PUC_RRS_SERVER::CClientMsgBusiness::CheckNeedSend (this=0x37ff2c0, setClientName=..., in_msgInfo=..., out_msg=...) at source/ProtocolProcHelper.cpp:650
#4  0x00007f3a425ebb37 in PUC_RRS_SERVER::CClientMsgBusiness::OnTimer (this=0x37ff2c0, in_nTimerID=93) at source/ProtocolProcHelper.cpp:88
#5  0x00007f3a62c3e802 in SEGCC::CTimerManager::OnThreadMessage (this=0x7f3a62e96880 <SEGCC::CTimerManager::g_mgr>, msg=...) at source/TimerManager.cpp:162
#6  0x00007f3a62c49622 in SEGCC::CThreadGroupMng::run (this=0x3623190) at source/ThreadGroupMng.cpp:286
#7  0x00007f3a62c2ca7e in SEGCC::Threadimpl::runnableEntry (pThread=0x3623900) at source/Thread_linux.cpp:168
#8  0x00007f3a6077edd5 in start_thread () from /lib64/libpthread.so.0
#9  0x00007f3a5f87d02d in clone () from /lib64/libc.so.6
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值