C语言 在gdb分析中如何处理sigkill

i2loujxw  于 2023-04-19  发布在  其他
关注(0)|答案(1)|浏览(214)

我在一个c++开源程序中得到了一个sigkill信号。但是gdb确实告诉了谁发送了这个信号以及为什么。有人能让我知道如何在gdb中继续这种情况吗?或者它将是裸露的源代码分析,需要找到根本原因

/home/ubuntu#gdb -p  `pidof e2`
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 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-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".
Attaching to process 2545141
[New LWP 2545201]
[New LWP 2545202]
[New LWP 2545203]
[New LWP 2545204]
[New LWP 2545205]
[New LWP 2545209]
[New LWP 2545210]
[New LWP 2545211]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

warning: Target and debugger are in different PID namespaces; thread lists and other data are likely unreliable.  Connect to gdbserver inside the container.
__pthread_clockjoin_ex (threadid=139679156389632, thread_return=0x0, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>) at pthread_join_common.c:145
145 pthread_join_common.c: No such file or directory.
(gdb) n
[Thread 0x7f09957fa700 (LWP 2545211) exited]
[Thread 0x7f0995ffb700 (LWP 2545210) exited]
[Thread 0x7f09967fc700 (LWP 2545209) exited]
[Thread 0x7f09977fe700 (LWP 2545204) exited]
[Thread 0x7f099d5bc700 (LWP 2545201) exited]
[Thread 0x7f099d5d4740 (LWP 2545141) exited]
[Thread 0x7f0996ffd700 (LWP 2545205) exited]
[Thread 0x7f099cdbb700 (LWP 2545202) exited]

Program terminated with signal SIGKILL, Killed.
The program no longer exists.
(gdb) info signals
Signal        Stop  Print   Pass to program Description

SIGHUP        Yes   Yes Yes     Hangup
SIGINT        Yes   Yes No      Interrupt
SIGKILL       Yes   Yes Yes     Killed
ctehm74n

ctehm74n1#

但gdb确实会告诉谁发送了它以及为什么。
这是因为当GDB意识到低级(正在调试的)进程发生了一些事情时,该进程已经“消失”了。
SIGKILL最常由内核发送,这是由于OOM(内存不足)的原因。请查看/var/log/messages(或您的发行版的等效版本)--它可能有一些提到oom的消息。
您可能没有足够的内存来运行此程序--您可能需要一个更大的系统,或者更改此程序的参数,使其不需要那么多内存。

相关问题