性能分析之C++ core dump分析

人生必须的知识就是引人向光明方面的明灯。这篇文章主要讲述性能分析之C++ core dump分析相关的知识,希望能为你提供帮助。
这个内容只是为了做个记录。
因为项目中有出现coredump的情况。 
先调起来。 
[app@主机A bin]$ gdb PROGRAM core.31018


下面是一连串的GDB信息。
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
Copyright (C) 2013 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".
For bug reporting instructions, please see:
< http://www.gnu.org/software/gdb/bugs/> ...
上面这段话的意思是,随便用,没毛病。


Reading symbols from /bin/PROGRAM...done.
[New LWP 31018]
[New LWP 31027]
[New LWP 31022]
[New LWP 31036]
[New LWP 31038]
[New LWP 31041]
[New LWP 31044]
[New LWP 31047]
[New LWP 31042]
[New LWP 31032]
[New LWP 31033]
[New LWP 31034]
[New LWP 31035]
[New LWP 31037]
[New LWP 31020]
[New LWP 31026]
[New LWP 31031]
[New LWP 31030]
[New LWP 31040]
[New LWP 31039]
[New LWP 31046]
[New LWP 31045]
[New LWP 31043]
[New LWP 31019]
[New LWP 31025]
[New LWP 31024]
[New LWP 31023]
[New LWP 31021]
[New LWP 31029]
[New LWP 31028]
上面是LWP编号,也就是我们常说的线程号,在linux中线程就是LWP,有人说,LWP不是线程,而是进程。因为是light-weight process嘛,肯定是进程,是的,又不是thread,确实它是叫做轻量级进程。但是在linux中,除了它其他的也没有线程了。看一下WIKI上说的:

In computer operating systems, a light-weight process (LWP) is a means of achieving multitasking. In the traditional meaning of the term, as used in Unix System V and Solaris, a LWP runs in user space on top of a single kernel thread and shares its address space and system resources with other LWPs within the same process. Multiple user level threads, managed by a thread library, can be placed on top of one or many LWPs - allowing multitasking to be done at the user level, which can have some performance benefits.
看了半天,也不知道所以然是啥对吧。那就对了,不用纠结,来跟我一起说,计较那么多概念干吗,这个东西就是线程!


[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
上面是说debug用的是啥子库。


Core was generated by `PROGRAM -g 1 -i 3006 -u VM_16_46_centos -U /data/app/log/LOG -m 0 -A\'.
Program terminated with signal 6, Aborted.
这里列出来了是怎么产生的core。 这里有信号6. 中止。 系统有多少信号呢?
大概是下面这么多。
信号

处理动作
发出信号的原因
标准
SIGHUP
1
A
终端挂起或者控制进程终止
POSIX.1
SIGINT
2
A
键盘中断(如break键被按下)
POSIX.1
SIGQUIT
3
C
键盘的退出键被按下
POSIX.1
SIGILL
4
C
非法指令
POSIX.1
SIGABRT
6
C
由abort(3)发出的退出指令
POSIX.1
SIGFPE
8
C
浮点异常
POSIX.1
SIGKILL
9
AEF
Kill信号
POSIX.1
SIGSEGV
11
C
无效的内存引用
POSIX.1
SIGPIPE
13
A
管道破裂:写一个没有读端口的管道
POSIX.1
SIGALRM
14
A
由alarm(2)发出的信号
POSIX.1
SIGTERM
15
A
终止信号
POSIX.1
SIGUSR1
30,10,16
A
用户自定义信号1
POSIX.1
SIGUSR2
31,12,17
A
用户自定义信号2
POSIX.1
SIGCHLD
20,17,18
B
子进程结束信号
POSIX.1
【性能分析之C++ core dump分析】SIGCONT
19,18,25


进程继续(曾被停止的进程)
POSIX.1
SIGSTOP
17,19,23
DEF
终止进程
POSIX.1
SIGTSTP
18,20,24
D
控制终端(tty)上按下停止键
POSIX.1
SIGTTIN
21,21,26
D
后台进程企图从控制终端读
POSIX.1
SIGTTOU
22,22,27
D
后台进程企图从控制终端写
POSIX.1
SIGBUS
10,7,10
C
总线错误(错误的内存访问)
SUSv2
SIGPOLL
A
Sys
V定义的Pollable事件,与SIGIO同义
SUSv2
SIGPROF
27,27,29
A
Profiling定时器到
SUSv2
SIGSYS
12,-,12
C
无效的系统调用(SVID)
SUSv2
SIGTRAP
5

    推荐阅读